Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
538eac74
Commit
538eac74
authored
Feb 13, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use same key for cache as for gravatar
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
91cdaf4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
weblate/accounts/avatar.py
weblate/accounts/avatar.py
+4
-5
No files found.
weblate/accounts/avatar.py
View file @
538eac74
...
...
@@ -20,7 +20,6 @@
from
__future__
import
unicode_literals
from
base64
import
b64encode
import
sys
import
hashlib
import
os.path
...
...
@@ -56,9 +55,11 @@ def avatar_for_email(email, size=80):
if
email
==
''
:
email
=
'noreply@weblate.org'
mail_hash
=
hashlib
.
md5
(
email
.
lower
().
encode
(
'utf-8'
)).
hexdigest
()
# Retrieve from cache
cache_key
=
'avatar-{0}-{1}'
.
format
(
b64encode
(
email
.
encode
(
'utf-8'
)).
strip
()
,
mail_hash
,
size
)
cache
=
caches
[
'default'
]
...
...
@@ -77,8 +78,6 @@ def avatar_for_email(email, size=80):
else
:
# Fallback to standard method
mail_hash
=
hashlib
.
md5
(
email
.
lower
()).
hexdigest
()
url
=
"{0}avatar/{1}?{2}"
.
format
(
appsettings
.
AVATAR_URL_PREFIX
,
mail_hash
,
...
...
@@ -112,7 +111,7 @@ def get_fallback_avatar(size):
settings
.
STATIC_ROOT
,
'weblate-{0}.png'
.
format
(
size
)
)
with
open
(
fallback
,
'r'
)
as
handle
:
with
open
(
fallback
,
'r
b
'
)
as
handle
:
return
handle
.
read
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment