mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
Use Python 3 compat import location for urlparse.
This commit is contained in:
parent
39ecc33ced
commit
286df0db56
1 changed files with 6 additions and 2 deletions
|
|
@ -1,7 +1,11 @@
|
|||
import urllib
|
||||
import urlparse
|
||||
import hashlib
|
||||
|
||||
try:
|
||||
from urllib.parse import urljoin
|
||||
except ImportError:
|
||||
from urlparse import urljoin
|
||||
|
||||
from django import template
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.template.loader import render_to_string
|
||||
|
|
@ -30,7 +34,7 @@ def avatar_url(user, size=AVATAR_DEFAULT_SIZE):
|
|||
params['d'] = AVATAR_GRAVATAR_DEFAULT
|
||||
path = "%s/?%s" % (hashlib.md5(user.email).hexdigest(),
|
||||
urllib.urlencode(params))
|
||||
return urlparse.urljoin(AVATAR_GRAVATAR_BASE_URL, path)
|
||||
return urljoin(AVATAR_GRAVATAR_BASE_URL, path)
|
||||
|
||||
return get_default_avatar_url()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue