Created on 2009-11-11.17:32:00 by tercero12, last changed 2009-12-03.22:22:58 by pjenvey.
|msg5306 (view)||Author: Timothy Farrell (tercero12)||Date: 2009-11-11.17:31:59|
I'm working on getting the web2py framework to work on Jython. I found this interesting bug: Traceback (most recent call last): File "C:\web2py2\gluon\main.py", line 442, in wsgibase session.connect(request, response) File "C:\web2py2\gluon\main.py", line 442, in wsgibase session.connect(request, response) File "C:\web2py2\gluon\globals.py", line 323, in connect response.cookies[response.session_id_name] = response.session_id File "C:\jython2.5.1\Lib\Cookie.py", line 579, in __setitem__ self.__set(key, rval, cval) File "C:\jython2.5.1\Lib\Cookie.py", line 572, in _BaseCookie__set M.set(key, real_value, coded_value) File "C:\jython2.5.1\Lib\Cookie.py", line 450, in set if "" != translate(key, idmap, LegalChars): File "C:\jython2.5.1\Lib\string.py", line 491, in translate return s.translate(table, deletions) TypeError: translate() takes 2 arguments (2 given) I've looked at a Cookie.py and string.py and they both seem on track. Maybe I'm missing something but it seems they're tripping something up in the interpreter. I can use the SimpleCookie class just fine in an interpreter and the key value in question is "session_id_init" so it's not like we're doing anything wierd.
|msg5344 (view)||Author: Philip Jenvey (pjenvey)||Date: 2009-12-03.22:22:57|
Likely the problem is response.session_id_name is a unicode object but Cookie expects a string. If that's the case it may or may not be Jython's fault. Jython has had some issues in the past where it returns unicode instead of strs, one common gotcha is Jython treats java.lang.Strings from Java as unicode objects. You'll need to narrow down where that unicode value came from originally. The confusing error message is a bug, but that's a duplicate of #1305, so I'm closing this issue out. Please reopen this or open a new ticket if it turns out to be something on our side.
|2009-12-03 22:22:58||pjenvey||set||status: open -> closed|
messages: + msg5344
nosy: + pjenvey