Revision: 8129
          http://svn.sourceforge.net/mailman/?rev=8129&view=rev
Author:   bwarsaw
Date:     2007-01-01 18:35:38 -0800 (Mon, 01 Jan 2007)

Log Message:
-----------
Ensure that exported XML is written in utf-8, at least if we're writing to a
file other than stdout.  Fix a typo in getting the digest style.  Update
copyright years.

Modified Paths:
--------------
    branches/Release_2_1-maint/mailman/bin/export.py

Modified: branches/Release_2_1-maint/mailman/bin/export.py
===================================================================
--- branches/Release_2_1-maint/mailman/bin/export.py    2006-12-31 23:20:48 UTC 
(rev 8128)
+++ branches/Release_2_1-maint/mailman/bin/export.py    2007-01-02 02:35:38 UTC 
(rev 8129)
@@ -1,6 +1,6 @@
 #! @PYTHON@
 #
-# Copyright (C) 2006 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -23,6 +23,7 @@
 import sys
 import sha
 import base64
+import codecs
 import datetime
 import optparse
 
@@ -145,8 +146,7 @@
         if _value is None:
             print >> self._fp, '<%s%s/>' % (_name, attrs)
         else:
-            # The value might contain angle brackets.
-            value = escape(str(_value))
+            value = escape(unicode(_value))
             print >> self._fp, '<%s%s>%s</%s>' % (_name, attrs, value, _name)
 
     def _do_list_categories(self, mlist, k, subcat=None):
@@ -230,7 +230,7 @@
                                    }.get(mlist.getDeliveryStatus(member),
                                          'unknown')
             if member in digesters:
-                if mlist.getMemberOption('plain'):
+                if mlist.getMemberOption(member, mm_cfg.DisableMime):
                     attrs['delivery'] = 'plain'
                 else:
                     attrs['delivery'] = 'mime'
@@ -358,9 +358,11 @@
     parser, opts, args = parseargs()
 
     if opts.outputfile in (None, '-'):
+        # This will fail if there are characters in the output incompatible
+        # with stdout.
         fp = sys.stdout
     else:
-        fp = open(opts.outputfile, 'w')
+        fp = codecs.open(opts.outputfile, 'w', 'utf-8')
 
     try:
         dumper = XMLDumper(fp)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to