• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revision479cd9eb34174521aba58063420bbba5e63a2c65 (tree)
Time2012-03-24 07:07:36
AuthorCory Johns <johnsca@geek...>
CommiterJenny Steele

Log Message

[#3852] Fixed Fixed unicode encode error when generating gravitar IDs

Signed-off-by: Cory Johns <johnsca@geek.net>

Change Summary

Incremental Difference

--- a/Allura/allura/lib/gravatar.py
+++ b/Allura/allura/lib/gravatar.py
@@ -14,7 +14,7 @@ def id(email):
1414 match = _wrapped_email.match(email)
1515 if match:
1616 email = match.group(1)
17- return hashlib.md5(email.strip().lower()).hexdigest()
17+ return hashlib.md5(email.strip().lower().encode('utf8')).hexdigest()
1818
1919 def url(email=None, gravatar_id=None, **kw):
2020 """Build a complete gravatar URL with our favorite defaults.
--- a/Allura/allura/tests/functional/test_gravatar.py
+++ b/Allura/allura/tests/functional/test_gravatar.py
@@ -12,6 +12,12 @@ class TestGravatar(TestController):
1212 actual_id = gravatar.id(email)
1313 assert expected_id == actual_id
1414
15+ def test_unicode_id(self):
16+ email = u'Vin\u00EDcius@example.com'
17+ expected_id = 'e00968255d68523b034a6a39c522efdb'
18+ actual_id = gravatar.id(email)
19+ assert expected_id == actual_id, 'Expected gravitar ID %s, got %s' % (repr(expected_id), repr(actual_id))
20+
1521 def test_url(self):
1622 email = 'Wolf@example.com'
1723 expected_id = 'd3514940ac1b2051c8aa42970d17e3fe'