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
eaeab2de
Commit
eaeab2de
authored
Mar 19, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use libravatar instead of gravatar
It is free service, which allows delegation.
parent
966ebe4f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
20 deletions
+20
-20
trans/templatetags/translations.py
trans/templatetags/translations.py
+3
-3
trans/util.py
trans/util.py
+14
-14
weblate/html/profile.html
weblate/html/profile.html
+2
-2
weblate/html/user.html
weblate/html/user.html
+1
-1
No files found.
trans/templatetags/translations.py
View file @
eaeab2de
...
...
@@ -37,7 +37,7 @@ import weblate
from
trans.simplediff
import
html_diff
from
trans.util
import
(
split_plural
,
gr
avatar_for_email
,
get_user_display
split_plural
,
avatar_for_email
,
get_user_display
)
from
lang.models
import
Language
from
trans.models
import
Project
,
SubProject
,
Dictionary
...
...
@@ -242,8 +242,8 @@ def show_message(tags, message):
@
register
.
simple_tag
def
gr
avatar
(
user
,
size
=
80
):
url
=
gr
avatar_for_email
(
user
.
email
,
size
)
def
avatar
(
user
,
size
=
80
):
url
=
avatar_for_email
(
user
.
email
,
size
)
alt
=
escape
(
_
(
'Avatar for %s'
)
%
get_user_display
(
user
,
False
))
return
"""<img src="%s" alt="Avatar for %s" height="%s" width="%s"/>"""
%
(
url
,
alt
,
size
,
size
...
...
trans/util.py
View file @
eaeab2de
...
...
@@ -28,33 +28,33 @@ import urllib
import
time
import
random
GR
AVATAR_URL_PREFIX
=
getattr
(
AVATAR_URL_PREFIX
=
getattr
(
settings
,
'
GR
AVATAR_URL_PREFIX'
,
'https://sec
ure.gravatar.com
/'
'AVATAR_URL_PREFIX'
,
'https://sec
cdn.libravatar.org
/'
)
# See http://
cs.gravatar.com/site/implement/images
/
# See http://
wiki.libravatar.org/api
/
# for available choices
GR
AVATAR_DEFAULT_IMAGE
=
getattr
(
AVATAR_DEFAULT_IMAGE
=
getattr
(
settings
,
'
GR
AVATAR_DEFAULT_IMAGE'
,
'AVATAR_DEFAULT_IMAGE'
,
'identicon'
)
PLURAL_SEPARATOR
=
'
\
x00
\
x00
'
def
gr
avatar_for_email
(
email
,
size
=
80
):
def
avatar_for_email
(
email
,
size
=
80
):
'''
Generates url for
gr
avatar.
Generates url for avatar.
'''
mail_hash
=
hashlib
.
md5
(
email
.
lower
()).
hexdigest
()
url
=
"%savatar/%s
/?"
%
(
GR
AVATAR_URL_PREFIX
,
mail_hash
)
url
=
"%savatar/%s
?"
%
(
AVATAR_URL_PREFIX
,
mail_hash
)
url
+=
urllib
.
urlencode
({
's'
:
str
(
size
),
'd'
:
GR
AVATAR_DEFAULT_IMAGE
'd'
:
AVATAR_DEFAULT_IMAGE
})
return
escape
(
url
)
...
...
@@ -86,12 +86,12 @@ def get_user_display(user, icon=True, link=False):
# Icon requested?
if
icon
:
# Get
gr
avatar image
gravatar
=
gr
avatar_for_email
(
email
,
size
=
32
)
# Get avatar image
avatar
=
avatar_for_email
(
email
,
size
=
32
)
full_name
=
'<img src="%(
gr
avatar)s" class="avatar" /> %(name)s'
%
{
full_name
=
'<img src="%(avatar)s" class="avatar" /> %(name)s'
%
{
'name'
:
full_name
,
'
gravatar'
:
gr
avatar
'
avatar'
:
avatar
}
if
link
and
profile
is
not
None
:
...
...
weblate/html/profile.html
View file @
eaeab2de
...
...
@@ -58,8 +58,8 @@
</p>
</div>
<div
id=
"avatar"
>
<p>
{%
gr
avatar request.user 128 %}
</p>
<p><a
href=
"http
://gravatar.com/emails/"
>
{% trans "Change your avatar at gravatar.com
" %}
</a></p>
<p>
{% avatar request.user 128 %}
</p>
<p><a
href=
"http
s://www.libravatar.org/"
>
{% trans "Avatars are provided using libravatar.
" %}
</a></p>
</div>
</div>
...
...
weblate/html/user.html
View file @
eaeab2de
...
...
@@ -11,7 +11,7 @@
<h2>
{{ page_profile.get_user_name }}
</h2>
{%
gr
avatar page_user 160 %}
{% avatar page_user 160 %}
{% if user_projects %}
...
...
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