Fixing broken unit test from prior commit. Need to deal with null (None) 'place...
authorinactivist <inactivist@gmail.com>
Tue, 13 Nov 2012 07:48:39 +0000 (23:48 -0800)
committerinactivist <inactivist@gmail.com>
Tue, 13 Nov 2012 07:48:39 +0000 (23:48 -0800)
tweepy/models.py

index f5838dd7c4fa2462f76cf2ead52590b45dd5e4a1..cae46ee6aacae9fe4bdab5d44bffe184c6791daa 100644 (file)
@@ -63,7 +63,10 @@ class Status(Model):
             elif k == 'retweeted_status':
                 setattr(status, k, Status.parse(api, v))
             elif k == 'place':
-                setattr(status, k, Place.parse(api, v))
+                if v is not None:
+                    setattr(status, k, Place.parse(api, v))
+                else:
+                    setattr(status, k, None)
             else:
                 setattr(status, k, v)
         return status
@@ -328,8 +331,9 @@ class BoundingBox(Model):
     @classmethod
     def parse(cls, api, json):
         result = cls(api)
-        for k, v in json.items():
-            setattr(result, k, v)
+        if json is not None:
+            for k, v in json.items():
+                setattr(result, k, v)
         return result
 
     def origin(self):