Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from sprintly/master

Updates to v0.3
  • Loading branch information...
commit c1fb7ffb8b152b76730b19f80226723af6f8d3ef 2 parents 844a5c5 + e2c46b6
@paltman paltman authored
Showing with 8 additions and 5 deletions.
  1. +1 −1  robotars/__init__.py
  2. +7 −4 robotars/templatetags/robotars_tags.py
View
2  robotars/__init__.py
@@ -1,2 +1,2 @@
# following PEP 386
-__version__ = "0.1"
+__version__ = "0.3"
View
11 robotars/templatetags/robotars_tags.py
@@ -1,7 +1,7 @@
# http://robohash.org/
from django import template
-from md5 import md5
+from hashlib import md5
register = template.Library()
@@ -9,14 +9,17 @@
@register.inclusion_tag("robotars/robotar.html")
def robotar(user, size=None, gravatar_fallback=False, hashed=False):
- url = "http://robohash.org/"
+ url = "//robohash.org/"
if gravatar_fallback:
+ email = user.email.lower()
if hashed:
- url += "%s?gravatar=hashed&" % md5(user.email).hexdigest()
+ url += "%s?gravatar=hashed&" % md5(email).hexdigest()
else:
- url += "%s?gravatar=yes&" % user.email
+ url += "%s?gravatar=yes&" % email
else:
url += "%s?" % user
if size is not None:
+ if size.isdigit():
+ size = "%sx%s" % (size, size)
url += 'size=%s' % size
return {"robotar_url": url, "robotar_user": user}
Please sign in to comment.
Something went wrong with that request. Please try again.