fix #123, #101: update gravatar url; fix avatar when GRAVATAR_SUPPORT T disabled

This commit is contained in:
slav0nic 2011-02-28 12:17:16 +02:00
parent 5a938a34fe
commit 24111a0d3c
3 changed files with 12 additions and 9 deletions

View file

@ -40,11 +40,15 @@
{{ post.user|forum_authority }}
</dd>
{% endif %}
{% if post.user.forum_profile.avatar and post.user.forum_profile.show_avatar %}
<dd class="postavatar"><img src="{{ post.user.forum_profile.avatar.url }}" /></dd>
{% else %}
<dd class="postavatar"><img src="{% gravatar post.user.email %}" /></dd>
{% endif %}
<dd class="postavatar">
{% if post.user.forum_profile.avatar and post.user.forum_profile.show_avatar %}
<img src="{{ post.user.forum_profile.avatar.url }}" />
{% else %}
{% if settings.GRAVATAR_SUPPORT %}
<img src="{% gravatar post.user.email %}" />
{% endif %}
{% endif %}
</dd>
{% if post.user.forum_profile.location %}
<dd>{% trans "From:" %} {{ post.user.forum_profile.location }}</dd>
{% endif %}

View file

@ -265,9 +265,8 @@ def new_reports():
def gravatar(email):
if forum_settings.GRAVATAR_SUPPORT:
size = max(forum_settings.AVATAR_WIDTH, forum_settings.AVATAR_HEIGHT)
url = "http://www.gravatar.com/avatar.php?"
url = "http://www.gravatar.com/avatar/%s?" % md5_constructor(email.lower()).hexdigest()
url += urllib.urlencode({
'gravatar_id': md5_constructor(email.lower()).hexdigest(),
'size': size,
'default': forum_settings.GRAVATAR_DEFAULT,
})

View file

@ -292,8 +292,8 @@ def set_language(request, language):
def convert_text_to_html(text, markup):
if markup == 'bbcode':
text = bbmarkup.bbcode(text)
elif markup == 'markdown':
elif markup == 'markdown':
text = markdown.markdown(text, safe_mode='escape')
else:
raise Exception('Invalid markup property: %s' % markup)
return urlize(text)
return urlize(text)