From 3c671146a7f9b692fdbd16ef0c7123e6af7df460 Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Thu, 13 May 2010 01:12:27 -0700 Subject: [PATCH] Fix same unicode-in-keywords bug elsewhere, cleanup for previous fix. --- github2/core.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/github2/core.py b/github2/core.py index 7b90d26..a97d0e4 100644 --- a/github2/core.py +++ b/github2/core.py @@ -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):