diff options
Diffstat (limited to 'djangorestframework/utils/__init__.py')
| -rw-r--r-- | djangorestframework/utils/__init__.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/djangorestframework/utils/__init__.py b/djangorestframework/utils/__init__.py index 04baea78..305311f4 100644 --- a/djangorestframework/utils/__init__.py +++ b/djangorestframework/utils/__init__.py @@ -36,7 +36,7 @@ def as_tuple(obj): return obj return (obj,) - + def url_resolves(url): """ Return True if the given URL is mapped to a view in the urlconf, False otherwise. @@ -50,7 +50,7 @@ def url_resolves(url): # From http://www.koders.com/python/fidB6E125C586A6F49EAC38992CF3AFDAAE35651975.aspx?s=mdef:xml #class object_dict(dict): -# """object view of dict, you can +# """object view of dict, you can # >>> a = object_dict() # >>> a.fish = 'fish' # >>> a['fish'] @@ -103,8 +103,8 @@ class XML2Dict(object): old = node_tree[tag] if not isinstance(old, list): node_tree.pop(tag) - node_tree[tag] = [old] # multi times, so change old dict to a list - node_tree[tag].append(tree) # add the new one + node_tree[tag] = [old] # multi times, so change old dict to a list + node_tree[tag].append(tree) # add the new one return node_tree @@ -117,13 +117,13 @@ class XML2Dict(object): """ result = re.compile("\{(.*)\}(.*)").search(tag) if result: - value.namespace, tag = result.groups() + value.namespace, tag = result.groups() return (tag, value) def parse(self, file): """parse a xml file to a dict""" f = open(file, 'r') - return self.fromstring(f.read()) + return self.fromstring(f.read()) def fromstring(self, s): """parse a string""" @@ -159,7 +159,7 @@ class XMLRenderer(): xml.characters(smart_unicode(data)) def dict2xml(self, data): - stream = StringIO.StringIO() + stream = StringIO.StringIO() xml = SimplerXMLGenerator(stream, "utf-8") xml.startDocument() @@ -172,4 +172,4 @@ class XMLRenderer(): return stream.getvalue() def dict2xml(input): - return XMLRenderer().dict2xml(input)
\ No newline at end of file + return XMLRenderer().dict2xml(input) |
