diff --git a/web/main/models.py b/web/main/models.py index 22f4f31b3..f5d030a2a 100644 --- a/web/main/models.py +++ b/web/main/models.py @@ -3474,7 +3474,10 @@ def inc_export_fails(self): orig = self.export_fails Casebook.objects.filter(id=self.id).update(export_fails=F("export_fails") + 1) self.refresh_from_db() - if orig < settings.MAX_EXPORT_ATTEMPTS and self.export_fails >= settings.MAX_EXPORT_ATTEMPTS: + if ( + orig < settings.MAX_EXPORT_ATTEMPTS + and self.export_fails >= settings.MAX_EXPORT_ATTEMPTS + ): message = f"Export of casebook {self.id} ({self.title}) has failed the maximum allowed times.\n\nPlease investigate, and reset to zero if the failures were spurious." send_mail( f"Export of H2O Casebook {self.id} is frozen.",