diff options
author | bwarsaw <> | 2007-01-02 02:35:38 +0000 |
---|---|---|
committer | bwarsaw <> | 2007-01-02 02:35:38 +0000 |
commit | b02bb1b229badb32dadf07b248fd32c4b03a300c (patch) | |
tree | 7bd1db289bc6216ab63222291cbe0ba23c25a0a9 /bin | |
parent | 5587ec896945677f9687c196ff272d9a52aa2e52 (diff) | |
download | mailman2-b02bb1b229badb32dadf07b248fd32c4b03a300c.tar.gz mailman2-b02bb1b229badb32dadf07b248fd32c4b03a300c.tar.xz mailman2-b02bb1b229badb32dadf07b248fd32c4b03a300c.zip |
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.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/export.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/export.py b/bin/export.py index 315b07ba..c8d890eb 100644 --- a/bin/export.py +++ b/bin/export.py @@ -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 os import sys import sha import base64 +import codecs import datetime import optparse @@ -145,8 +146,7 @@ class XMLDumper(object): 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 @@ class XMLDumper(object): }.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 @@ def main(): 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) |