]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
Fix issue with Python 3.4, Django 1.6 v2.0.0
authorStephen Finucane <stephen@that.guru>
Wed, 23 Aug 2017 18:05:49 +0000 (19:05 +0100)
committerStephen Finucane <stephen@that.guru>
Wed, 23 Aug 2017 18:06:23 +0000 (19:06 +0100)
Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: 866d14b4 ("models: Fix invocation of refresh_tag_counts() for Comments")
patchwork/models.py

index f8d24726756e8f3f1ac71d4321488cdfb073d6f8..d4075cf3f012a6e0e77e1ffd9ba896f2a960482f 100644 (file)
@@ -574,8 +574,12 @@ class Comment(EmailMixin, models.Model):
 
     def save(self, *args, **kwargs):
         super(Comment, self).save(*args, **kwargs)
-        if hasattr(self.submission, 'patch'):
-            self.submission.patch.refresh_tag_counts()
+        # NOTE(stephenfin): Mitigate an issue with Python 3.4 + Django 1.6
+        try:
+            if hasattr(self.submission, 'patch'):
+                self.submission.patch.refresh_tag_counts()
+        except Patch.DoesNotExist:
+            pass
 
     def delete(self, *args, **kwargs):
         super(Comment, self).delete(*args, **kwargs)