aboutsummaryrefslogtreecommitdiffstats
path: root/github3/helpers.py
diff options
context:
space:
mode:
authorKenneth Reitz <me@kennethreitz.com>2011-07-24 11:27:58 -0400
committerKenneth Reitz <me@kennethreitz.com>2011-07-24 11:27:58 -0400
commit513eb3c6f22fe9cd1422dd35f91d9c46168f7cf1 (patch)
treee2dd657fbb606bca5c87ae635ed038bb42d90550 /github3/helpers.py
parentdocs update (diff)
downloadpython-github3-513eb3c6f22fe9cd1422dd35f91d9c46168f7cf1.tar.xz
python-github3-513eb3c6f22fe9cd1422dd35f91d9c46168f7cf1.zip
Smarter to_python
Diffstat (limited to 'github3/helpers.py')
-rw-r--r--github3/helpers.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/github3/helpers.py b/github3/helpers.py
index 391fe1e..91b4be5 100644
--- a/github3/helpers.py
+++ b/github3/helpers.py
@@ -58,16 +58,18 @@ def to_python(obj,
if int_keys:
for in_key in int_keys:
- obj.__dict__[in_key] = int(in_dict.get(in_key))
+ if (in_dict is not None) and (in_dict.get(in_key) is not None):
+ obj.__dict__[in_key] = int(in_dict.get(in_key))
if bool_keys:
for in_key in bool_keys:
- obj.__dict__[in_key] = bool(in_dict.get(in_key))
+ if in_dict.get(in_key) is not None:
+ obj.__dict__[in_key] = bool(in_dict.get(in_key))
if object_map:
-
for (k, v) in object_map.items():
- obj.__dict__[k] = v.new_from_dict(in_dict.get(k))
+ if in_dict.get(k):
+ obj.__dict__[k] = v.new_from_dict(in_dict.get(k))
obj.__dict__.update(kwargs)