[python-debian/master] Fix some breakage the gpgcheck branch introduced

John Wright jsw at debian.org
Sat Aug 9 23:20:38 UTC 2008


Do not assume that the input was given as args[0] -- it might have been
given as the sequence keyword argument, or not at all (e.g. when using
the _parsed keyword argument for the apt_pkg interface).
---
 debian_bundle/deb822.py |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/debian_bundle/deb822.py b/debian_bundle/deb822.py
index 8f5fe13..05a6ca4 100644
--- a/debian_bundle/deb822.py
+++ b/debian_bundle/deb822.py
@@ -747,12 +747,18 @@ class Dsc(_multivalued):
     }
 
     def __init__(self, *args, **kwargs):
-        if args:
-            if isinstance(args[0], basestring):
-                self.raw_text = args[0]
+        try:
+            sequence = args[0]
+        except IndexError:
+            sequence = kwargs.get("sequence", None)
+
+        if sequence is not None:
+            if isinstance(sequence, basestring):
+                self.raw_text = sequence
             else:
-                self.raw_text = "".join(args[0])
-            args = (self.raw_text,) + args[1:]
+                self.raw_text = "".join(sequence)
+            kwargs["sequence"] = self.raw_text
+            args = args[1:]
 
         _multivalued.__init__(self, *args, **kwargs)
 
-- 
1.5.5.GIT




More information about the pkg-python-debian-commits mailing list