aboutsummaryrefslogtreecommitdiff
path: root/rpki/pubdb/models.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-11-11 03:22:38 +0000
committerRob Austein <sra@hactrn.net>2015-11-11 03:22:38 +0000
commit9f6d6462a9cef37735a9d4c61921d04934fd9864 (patch)
treee5d1b046f6f6bd44faf1b5028f6f1df9698e2a88 /rpki/pubdb/models.py
parentac415cdd0f88f8479975627772dd0a84797b261a (diff)
Configure pylint to use the pylint-django plugin, which (mostly)
understands Django's exotic metaclasses, which in turn allows us to re-enable a number of pylint checks we had disabled. While we were at this, stripped out a bunch of old pylint pragmas, then added back the subset that were really needed. As usual with pylint, this turned up a few real bugs along with an awful lot of noise. svn path=/branches/tk705/; revision=6162
Diffstat (limited to 'rpki/pubdb/models.py')
-rw-r--r--rpki/pubdb/models.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/rpki/pubdb/models.py b/rpki/pubdb/models.py
index 46dcf493..43600a5e 100644
--- a/rpki/pubdb/models.py
+++ b/rpki/pubdb/models.py
@@ -31,6 +31,8 @@ import rpki.relaxng
logger = logging.getLogger(__name__)
+# pylint: disable=W5101
+
# Some of this probably ought to move into a rpki.rrdp module.
rrdp_xmlns = rpki.relaxng.rrdp.xmlns
@@ -93,6 +95,8 @@ class Session(models.Model):
Construct a new delta associated with this session.
"""
+ # pylint: disable=W0201
+
delta = Delta(session = self,
serial = self.serial + 1,
expires = expires)
@@ -261,7 +265,10 @@ class Delta(models.Model):
def withdraw(self, client, uri, obj_hash):
- obj = client.publishedobject_set.get(session = self.session, uri = uri)
+ try:
+ obj = client.publishedobject_set.get(session = self.session, uri = uri)
+ except rpki.pubdb.models.PublishedObject.DoesNotExist:
+ raise rpki.exceptions.NoObjectAtURI("No published object found at %s" % uri)
if obj.hash != obj_hash:
raise rpki.exceptions.DifferentObjectAtURI("Found different object at %s (old %s, new %s)" % (uri, obj.hash, obj_hash))
logger.debug("Withdrawing %s", uri)
@@ -308,6 +315,6 @@ class PublishedObject(models.Model):
client = models.ForeignKey(Client)
session = models.ForeignKey(Session)
- class Meta: # pylint: disable=C1001,W0232
+ class Meta:
unique_together = (("session", "hash"),
("session", "uri"))