If no country, return None rather than Country class. Fixes http://stackoverflow.com/q/14609467/724176
This commit is contained in:
parent
6d5c818ad0
commit
56f3666ced
2 changed files with 27 additions and 2 deletions
|
@ -404,7 +404,7 @@ class _Network(object):
|
|||
def is_caching_enabled(self):
|
||||
"""Returns True if caching is enabled."""
|
||||
|
||||
return not (self.cache_backend == None)
|
||||
return not (self.cache_backend is None)
|
||||
|
||||
def _get_cache_backend(self):
|
||||
|
||||
|
@ -3052,7 +3052,12 @@ class User(_BaseObject):
|
|||
|
||||
doc = self._request("user.getInfo", True)
|
||||
|
||||
return Country(_extract(doc, "country"), self.network)
|
||||
country = _extract(doc, "country")
|
||||
|
||||
if country is None:
|
||||
return None
|
||||
else:
|
||||
return Country(country, self.network)
|
||||
|
||||
def get_age(self):
|
||||
"""Returns the user's age."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue