Grok python 2.6 HMAC
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grok |
Fix Released
|
Undecided
|
Kevin Teague |
Bug Description
try to run grok with python2.6, I have edited the buildout.cfg like that:
[versions]
mechanize = 0.1.9
zope.app.appsetup = 3.8.0
zope.app.component = 3.5.0
zope.app.container = 3.6.1
zope.app.form = 3.6.3
zope.app.publisher = 3.5.1
zope.app.testing = 3.5.6
zope.testbrowser = 3.5.1
According to the mailing list email from <email address hidden> subject [Grok-dev] Grok runs on Python 2.6 published the 15th Oct. 2008. But I am unable to get to to this URL http://
http://
This could be related to this mail
http://
but I don't know if a bug report was already filled ( at least I was not able to find it)
Is it the best place to report this problem?
Cheers,
yvan
I believe this is because the translate() string method changed in Python 2.6 (http:// bugs.python. org/issue1071) so that it now throws an error when trying to translate a unicode string with a str translation table.
On Python 2.4 and 2.5 you can do:
>>> import hmac u'nmeVoOHGCGpx4 XMhmTbl3jGG4vg' ,'0.93817239745 203817591' ,sha)
>>> import sha
>>> hmac.new(
<hmac.HMAC instance at 0x6bf08>
But on Python 2.6 this throws a "TypeError: character mapping must return integer, None or unicode".
A possible fix is to str() the session key before calling hmac.new() in zope.session. This works, but I'm not sure if this solution introduces any other bugs or if there is a better place to workaround this bug.