]> git.openstreetmap.org Git - osqa.git/commitdiff
make the xml exporter work
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 15 Apr 2012 21:27:39 +0000 (21:27 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 15 Apr 2012 21:27:39 +0000 (21:27 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1251 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum_modules/exporter/exporter.py

index e266858b131431753c4db1d489dacdb2cad44dc0..d0cc7aa5c0b7ce4e48cfc7cd6e748e3ad1bc6ba1 100644 (file)
@@ -252,7 +252,7 @@ def export_skinsfolder(tf):
 
 
 def export(options, user):
-    original__write = xml.etree.ElementTree.ElementTree._write
+    original__write = xml.etree.ElementTree.ElementTree.write
     xml.etree.ElementTree.ElementTree._write = Etree_pretty__write
     xml.etree.ElementTree._ElementInterface.add = ET_Element_add_tag
 
@@ -404,20 +404,22 @@ def export_users(u, el, anon_data):
         key.add('provider', a.provider)
         key.add('key', a.key)
 
+    try:
+        ss = u.subscription_settings
 
-    ss = u.subscription_settings
-
-    notify = el.add('notifications', enabled=ss.enable_notifications and 'true' or 'false')
+        notify = el.add('notifications', enabled=ss.enable_notifications and 'true' or 'false')
 
-    notify.add('notify', **dict([(t, ss.__dict__.get(t, 'n') == 'i' and 'true' or 'false') for t in ['member_joins', 'new_question', 'new_question_watched_tags', 'subscribed_questions']]))
+        notify.add('notify', **dict([(t, ss.__dict__.get(t, 'n') == 'i' and 'true' or 'false') for t in ['member_joins', 'new_question', 'new_question_watched_tags', 'subscribed_questions']]))
 
-    notify.add('autoSubscribe', **dict([(t, ss.__dict__.get(t, False) and 'true' or 'false') for t in [
-            'all_questions', 'all_questions_watched_tags', 'questions_asked', 'questions_answered', 'questions_commented', 'questions_viewed']]))
+        notify.add('autoSubscribe', **dict([(t, ss.__dict__.get(t, False) and 'true' or 'false') for t in [
+                'all_questions', 'all_questions_watched_tags', 'questions_asked', 'questions_answered', 'questions_commented', 'questions_viewed']]))
 
-    notify.add('notifyOnSubscribed', **dict([(t, ss.__dict__.get("notify_%s" % t, False) and 'true' or 'false') for t in [
-            'answers', 'reply_to_comments', 'comments_own_post', 'comments', 'accepted']]))
+        notify.add('notifyOnSubscribed', **dict([(t, ss.__dict__.get("notify_%s" % t, False) and 'true' or 'false') for t in [
+                'answers', 'reply_to_comments', 'comments_own_post', 'comments', 'accepted']]))
 
-    notify.add('digest', ss.send_digest and 'on' or 'off')
+        notify.add('digest', ss.send_digest and 'on' or 'off')
+    except SubscriptionSettings.DoesNotExist:
+        pass
 
     watched = el.add('watchedTags')
     rejected = el.add('rejectedTags')