summaryrefslogtreecommitdiff
path: root/lib/thandy/encodeToXML.py
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-01-22 10:54:34 -0500
committerNick Mathewson <nickm@torproject.org>2009-01-22 10:56:31 -0500
commitb64339f48280872deec7bb980a61e494f6f38c92 (patch)
treefe8262b8a6e7ca572cfe8c5c26720670697d8f8d /lib/thandy/encodeToXML.py
parent2068158fd08ca042b874422ee3826f40803f31d8 (diff)
Fix multiple pychecker-spotted typos.
These are mostly typos in methods that don't get used in the current Thandy, error in error-handling paths, modules we imported unnecessarily, etc.
Diffstat (limited to 'lib/thandy/encodeToXML.py')
-rw-r--r--lib/thandy/encodeToXML.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/thandy/encodeToXML.py b/lib/thandy/encodeToXML.py
index 4387c88..c563d77 100644
--- a/lib/thandy/encodeToXML.py
+++ b/lib/thandy/encodeToXML.py
@@ -1,6 +1,7 @@
# Copyright 2008 The Tor Project, Inc. See LICENSE for licensing information.
import re
+import thandy
def xml_str_encoder(s):
s = s.replace("&", "&amp;")
@@ -23,7 +24,7 @@ def isAsciiName(s):
"""
return re.match(r'^[A-Za-z\_\:][A-Za-z0-9\_\:\-\.]*$', s) != None
-def _encodeToXML(obj, outf, indent=0):
+def _encodeToXML(obj, outf):
if isinstance(obj, basestring):
outf(xml_str_encoder(obj))
elif obj is True:
@@ -35,7 +36,6 @@ def _encodeToXML(obj, outf, indent=0):
elif isinstance(obj, (int,long)):
outf(str(obj))
elif isinstance(obj, (tuple, list)):
- istr = " "*indent
outf("<list>\n")
for item in obj:
outf("<item>")
@@ -62,6 +62,7 @@ def encodeToXML(obj, outf=None):
"""Convert a json-encodable object to a quick-and-dirty XML equivalent."""
result = None
if outf == None:
+ result = []
outf = result.append
_encodeToXML(obj, outf)