From: Stephen Finucane Date: Wed, 23 Aug 2017 18:05:49 +0000 (+0100) Subject: Fix issue with Python 3.4, Django 1.6 X-Git-Tag: v2.0.0^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb7321bb36616d194313ab9d3151e508efb9b2a4;p=thirdparty%2Fpatchwork.git Fix issue with Python 3.4, Django 1.6 Signed-off-by: Stephen Finucane Fixes: 866d14b4 ("models: Fix invocation of refresh_tag_counts() for Comments") --- diff --git a/patchwork/models.py b/patchwork/models.py index f8d24726..d4075cf3 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -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)