diff options
author | Justus Winter <[email protected]> | 2016-07-11 10:29:17 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-07-11 15:50:58 +0000 |
commit | c53f87c5f9ca63119152f41dcebfb175d4df2cef (patch) | |
tree | 06a59868de59b0a668c2bb771c9343eeae63c285 /lang/python/pyme | |
parent | Qt: Fix memleaks in tests (diff) | |
download | gpgme-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 '')
-rw-r--r-- | lang/python/pyme/results.py | 9 |
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: |