python: Make result wrapping backwards compatible.
* lang/python/pyme/results.py (Result.__init__): Skip missing fields. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
bfa8ac7e02
commit
c53f87c5f9
@ -46,12 +46,11 @@ class Result(object):
|
|||||||
}
|
}
|
||||||
def __init__(self, fragile):
|
def __init__(self, fragile):
|
||||||
for key, func in self._type.items():
|
for key, func in self._type.items():
|
||||||
|
if hasattr(fragile, key):
|
||||||
setattr(self, key, func(getattr(fragile, key)))
|
setattr(self, key, func(getattr(fragile, key)))
|
||||||
|
|
||||||
for key, func in self._map.items():
|
for key, func in self._map.items():
|
||||||
setattr(self, key, list(map(func, getattr(fragile, key))))
|
if hasattr(fragile, key):
|
||||||
|
|
||||||
for key, func in self._map.items():
|
|
||||||
setattr(self, key, list(map(func, getattr(fragile, key))))
|
setattr(self, key, list(map(func, getattr(fragile, key))))
|
||||||
|
|
||||||
for key in dir(fragile):
|
for key in dir(fragile):
|
||||||
|
Loading…
Reference in New Issue
Block a user