mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
Merge branch 'main' into update-versions
This commit is contained in:
commit
7840c74122
2 changed files with 19 additions and 10 deletions
14
.github/workflows/test.yml
vendored
14
.github/workflows/test.yml
vendored
|
|
@ -6,19 +6,19 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
|
||||
django-version: ['4.2', '5.2', '6.0']
|
||||
django-version: ['4.2', '5.2', '6.0.*']
|
||||
exclude:
|
||||
- python-version: 3.10
|
||||
django-version: 6.0
|
||||
|
||||
- python-version: 3.11
|
||||
django-version: 6.0
|
||||
|
||||
- python-version: 3.13
|
||||
django-version: 4.2
|
||||
|
||||
- python-version: 3.14
|
||||
django-version: 4.2
|
||||
|
||||
- python-version: 3.10
|
||||
django-version: 6.0.*
|
||||
|
||||
- python-version: 3.11
|
||||
django-version: 6.0.*
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class GravatarAvatarProvider(object):
|
|||
|
||||
class LibRAvatarProvider:
|
||||
"""
|
||||
Returns the url of an avatar by the Ravatar service.
|
||||
Returns the url of an avatar by the LibRavatar service.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
|
|
@ -87,8 +87,17 @@ class LibRAvatarProvider:
|
|||
baseurl = "http://" + hostname + ":" + port + "/avatar/"
|
||||
except Exception:
|
||||
baseurl = "https://seccdn.libravatar.org/avatar/"
|
||||
hash = hashlib.md5(email.strip().lower()).hexdigest()
|
||||
return baseurl + hash
|
||||
|
||||
params = {"s": str(width)}
|
||||
if settings.AVATAR_GRAVATAR_DEFAULT:
|
||||
params["d"] = settings.AVATAR_GRAVATAR_DEFAULT
|
||||
if settings.AVATAR_GRAVATAR_FORCEDEFAULT:
|
||||
params["f"] = "y"
|
||||
path = "%s/?%s" % (
|
||||
hashlib.md5(force_bytes(email.strip().lower())).hexdigest(),
|
||||
urlencode(params),
|
||||
)
|
||||
return urljoin(baseurl, path)
|
||||
|
||||
|
||||
class FacebookAvatarProvider(object):
|
||||
|
|
|
|||
Loading…
Reference in a new issue