Skip to content

Commit 3c67114

Browse files
committed
Fix same unicode-in-keywords bug elsewhere, cleanup for previous fix.
1 parent f4f93bf commit 3c67114

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

github2/core.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,19 @@ def get_value(self, *args, **kwargs):
5252
# unicode keys are not accepted as kwargs by python, see:
5353
#http://mail-archives.apache.org/mod_mbox/qpid-dev/200609.mbox/%3C1159389941.4505.10.camel@localhost.localdomain%3E
5454
# So we make a local dict with the same keys but as strings:
55-
val = dict( (str(k), v) for (k,v) in value.iteritems() )
56-
return datatype(**val)
55+
return datatype(**dict((str(k), v) for (k,v) in value.iteritems()))
5756
return value
5857

5958
def get_values(self, *args, **kwargs):
6059
datatype = kwargs.pop("datatype", None)
6160
values = self.make_request(*args, **kwargs)
6261
if datatype:
63-
return [datatype(**value) for value in values]
64-
return values
62+
# Same as above, unicode keys will blow up in **args, so we need to
63+
# create a new 'values' dict with string keys
64+
return [ datatype(**dict((str(k), v) for (k,v) in value.iteritems()))
65+
for value in values ]
66+
else:
67+
return values
6568

6669

6770
def doc_generator(docstring, attributes):

0 commit comments

Comments
 (0)