[Pkg-gnupg-commit] [gpgme] 214/412: python: Make result wrapping backwards compatible.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit c53f87c5f9ca63119152f41dcebfb175d4df2cef
Author: Justus Winter <justus at g10code.com>
Date:   Mon Jul 11 12:29:17 2016 +0200

    python: Make result wrapping backwards compatible.
    
    * lang/python/pyme/results.py (Result.__init__): Skip missing fields.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 lang/python/pyme/results.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lang/python/pyme/results.py b/lang/python/pyme/results.py
index e6e8968..aa9b38e 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:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list