From c1566d66fa267f898656ee029baa85d61ba9d852 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 18 Sep 2013 00:04:18 +0300 Subject: Return None on invalid attribute access --- gsxws/objectify.py | 4 ++-- 1 file 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) -- cgit v1.2.3