From fb7321bb36616d194313ab9d3151e508efb9b2a4 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 23 Aug 2017 19:05:49 +0100 Subject: [PATCH] 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") --- patchwork/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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) -- 2.47.3