aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/pyme/results.py
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-07-11 10:29:17 +0000
committerJustus Winter <[email protected]>2016-07-11 15:50:58 +0000
commitc53f87c5f9ca63119152f41dcebfb175d4df2cef (patch)
tree06a59868de59b0a668c2bb771c9343eeae63c285 /lang/python/pyme/results.py
parentQt: Fix memleaks in tests (diff)
downloadgpgme-c53f87c5f9ca63119152f41dcebfb175d4df2cef.tar.gz
gpgme-c53f87c5f9ca63119152f41dcebfb175d4df2cef.zip
python: Make result wrapping backwards compatible.
* lang/python/pyme/results.py (Result.__init__): Skip missing fields. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'lang/python/pyme/results.py')
-rw-r--r--lang/python/pyme/results.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/lang/python/pyme/results.py b/lang/python/pyme/results.py
index e6e89689..aa9b38e6 100644
--- a/lang/python/pyme/results.py
+++ b/lang/python/pyme/results.py
@@ -46,13 +46,12 @@ class Result(object):
}
def __init__(self, fragile):
for key, func in self._type.items():
- setattr(self, key, func(getattr(fragile, key)))
+ if hasattr(fragile, key):
+ setattr(self, key, func(getattr(fragile, key)))
for key, func in self._map.items():
- setattr(self, key, list(map(func, getattr(fragile, key))))
-
- for key, func in self._map.items():
- setattr(self, key, list(map(func, getattr(fragile, key))))
+ if hasattr(fragile, key):
+ setattr(self, key, list(map(func, getattr(fragile, key))))
for key in dir(fragile):
if key.startswith('_') or key in self._blacklist: