← Back to team overview

launchpad-dev team mailing list archive

Re: question re. canonical.launchpad.mail.signed_message_from_string

 

Bjorn Tillenius wrote:
> On Thu, Oct 01, 2009 at 08:40:24AM +0200, Muharem Hrnjadovic wrote:
>> Hello there!
>>
>> I came across this yesterday: when the text in question has no GPG/PGP
>> signature the value of 'signedContent' may not be what you expect i.e.
>> it is None:
> 
> I don't follow. How do you have content that is signed, if you don't
> have a signature?

Sorry for not explaining better :) this is due to a situation (in
PackageUpload._stripPgpSignature()) where the content of a .changes file
may be signed or unsigned.

I have resolved it by checking whether 'signedContent' is None and
assuming that it was unsigned in first place.

{{{
         text = "".join(changes_lines)
         signed_message = signed_message_from_string(text)
-        return signed_message.signedContent.splitlines(True)
+        # For unsigned '.changes' files we'll get a None `signedContent`.
+        if signed_message.signedContent is not None:
+            return signed_message.signedContent.splitlines(True)
+        else:
+            return changes_lines
}}}

Best regards

-- 
Muharem Hrnjadovic <muharem@xxxxxxxxxx>
Public key id   : B2BBFCFC
Key fingerprint : A5A3 CC67 2B87 D641 103F  5602 219F 6B60 B2BB FCFC

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References