Make Package.signature return str key_id
We use the attribute in many places, but it's a "bytes" object in pgpdump that messes up the remaining logic. Let's just wrap it from the very beginning.
This commit is contained in:
parent
4a2c87b0f6
commit
a5d05569df
@ -7,7 +7,7 @@
|
||||
from django.contrib.sites.models import Site
|
||||
|
||||
from .fields import PositiveBigIntegerField
|
||||
from .utils import set_created_field, DependStandin
|
||||
from .utils import set_created_field, DependStandin, SignatureWrapper
|
||||
from devel.models import DeveloperKey
|
||||
from packages.alpm import AlpmAPI
|
||||
|
||||
@ -142,7 +142,7 @@ def signature(self):
|
||||
return None
|
||||
data = BinaryData(self.signature_bytes)
|
||||
packets = list(data.packets())
|
||||
return packets[0]
|
||||
return SignatureWrapper(packets[0])
|
||||
|
||||
@property
|
||||
def signer(self):
|
||||
|
@ -6,6 +6,7 @@
|
||||
import hashlib
|
||||
import markdown
|
||||
from markdown.extensions import Extension
|
||||
from pgpdump.packet import SignaturePacket
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.db import connections, router
|
||||
@ -165,4 +166,12 @@ def __init__(self, depends):
|
||||
self.deptype = first.deptype
|
||||
self.pkg = first.pkg.base_package() or PackageStandin(first.pkg)
|
||||
|
||||
|
||||
class SignatureWrapper(SignaturePacket):
|
||||
'Decode key_id from raw SignaturePacket'
|
||||
def __init__(self, packet):
|
||||
for field in ("sig_version", "creation_time", "expiration_time"):
|
||||
setattr(self, field, getattr(packet, field))
|
||||
self.key_id = str(packet.key_id) if packet.key_id else None
|
||||
|
||||
# vim: set ts=4 sw=4 et:
|
||||
|
Loading…
Reference in New Issue
Block a user