mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
Replace Django hashcompat with hashlib
This fixes a DeprecationWarning in Django 1.5, which recommends no longer using django.utils.hashcompat.
This commit is contained in:
parent
6512c38dcb
commit
5cd280a121
1 changed files with 2 additions and 2 deletions
|
|
@ -1,10 +1,10 @@
|
|||
import urllib
|
||||
import urlparse
|
||||
import hashlib
|
||||
|
||||
from django import template
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.hashcompat import md5_constructor
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
|
|
@ -28,7 +28,7 @@ def avatar_url(user, size=AVATAR_DEFAULT_SIZE):
|
|||
params = {'s': str(size)}
|
||||
if AVATAR_GRAVATAR_DEFAULT:
|
||||
params['d'] = AVATAR_GRAVATAR_DEFAULT
|
||||
path = "%s/?%s" % (md5_constructor(user.email).hexdigest(),
|
||||
path = "%s/?%s" % (hashlib.md5(user.email).hexdigest(),
|
||||
urllib.urlencode(params))
|
||||
return urlparse.urljoin(AVATAR_GRAVATAR_BASE_URL, path)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue