diff options
author | Filipp Lepalaan <f@230.to> | 2013-09-18 00:04:18 +0300 |
---|---|---|
committer | Filipp Lepalaan <f@230.to> | 2013-09-18 00:04:18 +0300 |
commit | c1566d66fa267f898656ee029baa85d61ba9d852 (patch) | |
tree | f711adcc401f9e1c54c93d4167b526ddf66b3b09 /gsxws | |
parent | ea99def3781fe7ca8b81190996815e1951d395bb (diff) | |
download | py-gsxws-c1566d66fa267f898656ee029baa85d61ba9d852.tar.gz py-gsxws-c1566d66fa267f898656ee029baa85d61ba9d852.tar.bz2 py-gsxws-c1566d66fa267f898656ee029baa85d61ba9d852.zip |
Return None on invalid attribute access
Diffstat (limited to 'gsxws')
-rw-r--r-- | gsxws/objectify.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gsxws/objectify.py b/gsxws/objectify.py index e310115..14b7aa2 100644 --- a/gsxws/objectify.py +++ b/gsxws/objectify.py @@ -85,7 +85,7 @@ class GsxElement(objectify.ObjectifiedElement): practical to return and empty string than to expect AttributeErrors all over your application. """ - return None + return if isinstance(result, objectify.NumberElement): return result.pyval @@ -104,7 +104,7 @@ class GsxElement(objectify.ObjectifiedElement): return gsx_attachment(result) if name in FLOAT_TYPES: return gsx_price(result) - if re.search(r'Date$', name): + if name.endswith('Date'): return gsx_date(result) if re.search(r'^[YN]$', result): return gsx_boolean(result) |