aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws/objectify.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-09-08 22:34:08 +0300
committerFilipp Lepalaan <f@230.to>2013-09-08 22:34:08 +0300
commitf1e1789e1a9cdebf5268d0fa3dd2846178669777 (patch)
tree965286e26e500854843f4fe095190982bf097b3e /gsxws/objectify.py
parent56be452b6d8485e598ce9f5a532f5adb548f5c2c (diff)
downloadpy-gsxws-f1e1789e1a9cdebf5268d0fa3dd2846178669777.tar.gz
py-gsxws-f1e1789e1a9cdebf5268d0fa3dd2846178669777.tar.bz2
py-gsxws-f1e1789e1a9cdebf5268d0fa3dd2846178669777.zip
Return None instead of AttributeError
Diffstat (limited to 'gsxws/objectify.py')
-rw-r--r--gsxws/objectify.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/gsxws/objectify.py b/gsxws/objectify.py
index a1856d9..5658d1a 100644
--- a/gsxws/objectify.py
+++ b/gsxws/objectify.py
@@ -77,13 +77,21 @@ def gsx_timestamp(value):
class GsxElement(objectify.ObjectifiedElement):
def __getattribute__(self, name):
- result = super(GsxElement, self).__getattribute__(name)
+ try:
+ result = super(GsxElement, self).__getattribute__(name)
+ except AttributeError:
+ """
+ The XML returned by GSX can be pretty inconsistent, especially
+ between the different environments. It's therefore more
+ practical to return None than to look for AttributeErrors all
+ over your application...
+ """
+ return
if isinstance(result, objectify.NumberElement):
return result.pyval
if isinstance(result, objectify.StringElement):
-
name = result.tag
result = result.text