Try fixing memcache error
This commit is contained in:
parent
8da03aebb0
commit
67a3c7274e
2 changed files with 9 additions and 6 deletions
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue