From 2126b1aef380df1fea9a109342bcbce44746583d Mon Sep 17 00:00:00 2001 From: Julien Constant Date: Wed, 8 Mar 2023 02:06:23 +0100 Subject: [PATCH] black --- sas/models.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sas/models.py b/sas/models.py index 944b646f..c66c6498 100644 --- a/sas/models.py +++ b/sas/models.py @@ -78,16 +78,20 @@ class Picture(SithFile): # Result is cached 4s for this user if user.is_anonymous: return False - + perm = cache.get("%d_can_view_pictures" % (user.id), False) - + # use cache only when user is in SAS Admins or when picture is moderated if perm and (self.is_moderated or self.can_be_edited_by(user)): return perm - - perm = self.is_in_sas and (self.is_moderated or self.can_be_edited_by(user)) and user.was_subscribed + + perm = ( + self.is_in_sas + and (self.is_moderated or self.can_be_edited_by(user)) + and user.was_subscribed + ) cache.set("%d_can_view_pictures" % (user.id), perm, timeout=4) - + return perm def get_download_url(self):