mirror of
https://github.com/kennethreitz-archive/github2.git
synced 2026-06-05 23:50:18 +00:00
Fix same unicode-in-keywords bug elsewhere, cleanup for previous fix.
This commit is contained in:
+7
-4
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user