[foaf] we should encode email addr: even if we know it should be ascii, nothing prevent from putting something else in (tests at least do it) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 24 Sep 2010 18:20:57 +0200
branchstable
changeset 6339 bdc3dc94d744
parent 6338 b520b86113e3
child 6340 470d8e828fda
[foaf] we should encode email addr: even if we know it should be ascii, nothing prevent from putting something else in (tests at least do it)
web/views/cwuser.py
--- a/web/views/cwuser.py	Fri Sep 24 18:20:45 2010 +0200
+++ b/web/views/cwuser.py	Fri Sep 24 18:20:57 2010 +0200
@@ -85,7 +85,8 @@
                    % xml_escape(entity.firstname))
         emailaddr = entity.cw_adapt_to('IEmailable').get_email()
         if emailaddr:
-            self.w(u'<foaf:mbox_sha1sum>%s</foaf:mbox_sha1sum>\n' % hashlib.sha1(emailaddr).hexdigest())
+            self.w(u'<foaf:mbox_sha1sum>%s</foaf:mbox_sha1sum>\n'
+                   % hashlib.sha1(emailaddr.encode('utf-8')).hexdigest())
         self.w(u'</foaf:Person>\n')