diff options
| author | maurizio <maurizio.sambati@gmail.com> | 2012-05-08 17:25:31 +0200 |
|---|---|---|
| committer | maurizio <maurizio.sambati@gmail.com> | 2012-05-08 17:25:31 +0200 |
| commit | 6524ef501d99e959dc8d1f1c5b852f8f2849ddc7 (patch) | |
| tree | 86c0e476eaf9087b387401d0683f7ca9bfb03b60 | |
| parent | 2e729c6c331982e1e0d439c6e5ba04c99c670029 (diff) | |
Comment._get_userinfo is thread safe now
| -rw-r--r-- | django/contrib/comments/models.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/django/contrib/comments/models.py b/django/contrib/comments/models.py index e0ef8b3d28..475b3c8dea 100644 --- a/django/contrib/comments/models.py +++ b/django/contrib/comments/models.py @@ -92,7 +92,7 @@ class Comment(BaseCommentAbstractModel): This dict will have ``name``, ``email``, and ``url`` fields. """ if not hasattr(self, "_userinfo"): - self._userinfo = { + userinfo = { "name" : self.user_name, "email" : self.user_email, "url" : self.user_url @@ -100,15 +100,16 @@ class Comment(BaseCommentAbstractModel): if self.user_id: u = self.user if u.email: - self._userinfo["email"] = u.email + userinfo["email"] = u.email # If the user has a full name, use that for the user name. # However, a given user_name overrides the raw user.username, # so only use that if this comment has no associated name. if u.get_full_name(): - self._userinfo["name"] = self.user.get_full_name() + userinfo["name"] = self.user.get_full_name() elif not self.user_name: - self._userinfo["name"] = u.username + userinfo["name"] = u.username + self._userinfo = userinfo return self._userinfo userinfo = property(_get_userinfo, doc=_get_userinfo.__doc__) |
