2006-12-18 Alex Roitman <shura@gramps-project.org>

* src/PluginUtils/_Options.py (save): Escape special characters.



svn: r7818
This commit is contained in:
Alex Roitman 2006-12-19 04:53:42 +00:00
parent e0c8c1379b
commit 740a436e76
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,6 @@
2006-12-18 Alex Roitman <shura@gramps-project.org>
* src/PluginUtils/_Options.py (save): Escape special characters.
2006-12-18 Don Allingham <don@gramps-project.org> 2006-12-18 Don Allingham <don@gramps-project.org>
* src/DataViews/_PersonView.py: exact search for gender (bug #633) * src/DataViews/_PersonView.py: exact search for gender (bug #633)
* src/DisplayModels/_PeopleModel.py: exact search for gender (bug #633) * src/DisplayModels/_PeopleModel.py: exact search for gender (bug #633)

View File

@ -39,8 +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
except: except:
from _xmlplus.sax import make_parser,handler,SAXParseException from _xmlplus.sax import make_parser,handler,SAXParseException
from _xmlplus.sax.saxutils import escape
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -194,19 +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' % module_name) f.write('<module name="%s">\n' % escape(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' % (
option_name, len(options[option_name]) ) ) escape(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, options[option_name][list_index]) ) list_index,
escape(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' % (
option_name,options[option_name]) ) escape(option_name),
escape(options[option_name])) )
self.write_module_common(f,option_list) self.write_module_common(f,option_list)