From 9f6d6462a9cef37735a9d4c61921d04934fd9864 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 11 Nov 2015 03:22:38 +0000 Subject: 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 --- rpki/pubdb/models.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'rpki/pubdb/models.py') 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")) -- cgit v1.2.3