Fix same unicode-in-keywords bug elsewhere, cleanup for previous fix.

This commit is contained in:
Fernando Perez
2010-05-13 01:12:27 -07:00
parent f4f93bfe6a
commit 3c671146a7
+7 -4
View File
@@ -52,16 +52,19 @@ class GithubCommand(object):
# unicode keys are not accepted as kwargs by python, see:
#http://mail-archives.apache.org/mod_mbox/qpid-dev/200609.mbox/%3C1159389941.4505.10.camel@localhost.localdomain%3E
# So we make a local dict with the same keys but as strings:
val = dict( (str(k), v) for (k,v) in value.iteritems() )
return datatype(**val)
return datatype(**dict((str(k), v) for (k,v) in value.iteritems()))
return value
def get_values(self, *args, **kwargs):
datatype = kwargs.pop("datatype", None)
values = self.make_request(*args, **kwargs)
if datatype:
return [datatype(**value) for value in values]
return values
# Same as above, unicode keys will blow up in **args, so we need to
# create a new 'values' dict with string keys
return [ datatype(**dict((str(k), v) for (k,v) in value.iteritems()))
for value in values ]
else:
return values
def doc_generator(docstring, attributes):