diff options
author | Dan McGee <dan@archlinux.org> | 2013-11-25 21:10:25 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-11-25 21:10:25 -0600 |
commit | 108cfaa8df3b94031a3436fbb71c76fdc0650ba1 (patch) | |
tree | 61c30085b49e63c6605dfebac3bef5e123cbaa70 /main/models.py | |
parent | 06317908f73420224fce0c400048c3b7dcfc8abb (diff) | |
parent | 071bd6bd71f681c45048fc0a0961e58d43d44d48 (diff) |
Merge branch 'django-1.6'
Diffstat (limited to 'main/models.py')
-rw-r--r-- | main/models.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/main/models.py b/main/models.py index 2ace0109..3f964082 100644 --- a/main/models.py +++ b/main/models.py @@ -1,4 +1,3 @@ -from base64 import b64decode from datetime import datetime from itertools import groupby from pgpdump import BinaryData @@ -97,7 +96,7 @@ class Package(models.Model): pkgver = models.CharField(max_length=255) pkgrel = models.CharField(max_length=255) epoch = models.PositiveIntegerField(default=0) - pkgdesc = models.TextField(null=True) + pkgdesc = models.TextField('description', null=True) url = models.CharField(max_length=255, null=True) filename = models.CharField(max_length=255) compressed_size = PositiveBigIntegerField() @@ -106,10 +105,10 @@ class Package(models.Model): last_update = models.DateTimeField(db_index=True) files_last_update = models.DateTimeField(null=True, blank=True) created = models.DateTimeField() - packager_str = models.CharField(max_length=255) + packager_str = models.CharField('packager string', max_length=255) packager = models.ForeignKey(User, null=True, blank=True, on_delete=models.SET_NULL) - pgp_signature = models.TextField(null=True, blank=True) + signature_bytes = models.BinaryField('PGP signature', null=True) flag_date = models.DateTimeField(null=True, blank=True) objects = PackageManager() @@ -140,13 +139,9 @@ class Package(models.Model): @property def signature(self): - try: - data = b64decode(self.pgp_signature.encode('utf-8')) - except TypeError: - return None - if not data: + if not self.signature_bytes: return None - data = BinaryData(data) + data = BinaryData(self.signature_bytes) packets = list(data.packets()) return packets[0] |