0002279: report-options.xml cannot manage option value with double quotes.

svn: r10894
This commit is contained in:
Brian Matherly 2008-07-21 04:44:07 +00:00
parent 3adda9b844
commit 3adcf13ce1

View File

@ -39,10 +39,10 @@ import os
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
try: try:
from xml.sax import make_parser, handler,SAXParseException from xml.sax import make_parser, handler,SAXParseException
from xml.sax.saxutils import escape from xml.sax.saxutils import quoteattr
except: except:
from _xmlplus.sax import make_parser, handler,SAXParseException from _xmlplus.sax import make_parser, handler,SAXParseException
from _xmlplus.sax.saxutils import escape from _xmlplus.sax.saxutils import quoteattr
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -196,22 +196,22 @@ class OptionListCollection:
for module_name in self.get_module_names(): for module_name in self.get_module_names():
option_list = self.get_option_list(module_name) option_list = self.get_option_list(module_name)
f.write('<module name="%s">\n' % escape(module_name)) f.write('<module name=%s>\n' % quoteattr(module_name))
options = option_list.get_options() options = option_list.get_options()
for option_name in options.keys(): for option_name in options.keys():
if type(options[option_name]) in (type(list()),type(tuple())): if type(options[option_name]) in (type(list()),type(tuple())):
f.write(' <option name="%s" value="" length="%d">\n' % ( f.write(' <option name=%s value="" length="%d">\n' % (
escape(option_name), quoteattr(option_name),
len(options[option_name]) ) ) len(options[option_name]) ) )
for list_index in range(len(options[option_name])): for list_index in range(len(options[option_name])):
f.write(' <listitem number="%d" value="%s"/>\n' % ( f.write(' <listitem number="%d" value=%s/>\n' % (
list_index, list_index,
escape(unicode(options[option_name][list_index]))) ) quoteattr(unicode(options[option_name][list_index]))) )
f.write(' </option>\n') f.write(' </option>\n')
else: else:
f.write(' <option name="%s" value="%s"/>\n' % ( f.write(' <option name=%s value=%s/>\n' % (
escape(option_name), quoteattr(option_name),
escape(unicode(options[option_name]))) ) quoteattr(unicode(options[option_name]))) )
self.write_module_common(f, option_list) self.write_module_common(f, option_list)