From 67a3c7274e5dbef218683905731ad4469932304a Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Tue, 10 Oct 2023 21:01:06 -0500 Subject: [PATCH] Try fixing memcache error --- judge/jinja2/gravatar.py | 4 ++-- judge/models/profile.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/judge/jinja2/gravatar.py b/judge/jinja2/gravatar.py index 373f685..b6e8a83 100644 --- a/judge/jinja2/gravatar.py +++ b/judge/jinja2/gravatar.py @@ -12,8 +12,8 @@ from . import registry def gravatar(profile, size=80, default=None, profile_image=None, email=None): if profile_image: return profile_image - if profile and profile.cached_profile_image: - return profile.cached_profile_image.url + if profile and profile.profile_image_url: + return profile.profile_image_url if profile: email = email or profile.email if default is None: diff --git a/judge/models/profile.py b/judge/models/profile.py index 05c5770..9f7b931 100644 --- a/judge/models/profile.py +++ b/judge/models/profile.py @@ -259,15 +259,18 @@ class Profile(models.Model): max_length=300, ) - @cache_wrapper(prefix="Pgbi") + @cache_wrapper(prefix="Pgbi2") def _get_basic_info(self): + profile_image_url = None + if self.profile_image: + profile_image_url = self.profile_image.url return { "first_name": self.user.first_name, "last_name": self.user.last_name, "email": self.user.email, "username": self.user.username, "mute": self.mute, - "profile_image": self.profile_image, + "profile_image_url": profile_image_url, } @cached_property @@ -301,8 +304,8 @@ class Profile(models.Model): return self._cached_info["mute"] @cached_property - def cached_profile_image(self): - return self._cached_info["profile_image"] + def profile_image_url(self): + return self._cached_info["profile_image_url"] @cached_property def count_unseen_notifications(self):