[mod_python] Re: Cookie problems with mobile phones

Robert Wallner kodixos at gmail.com
Thu Nov 10 12:30:32 EST 2005


On 11/10/05, Sebastjan Trepca <trepca at gmail.com> wrote:
> Hi,
>
> we have a problem when users access our site with mobile devices, it
> seems that Cookie class has some problems with them...
>
> Apache access log:
> 213.229.249.42 - - [10/Nov/2005:11:50:32 +0100] "GET / HTTP/1.1" 500
> 601 "-" "SonyEricssonZ1010/R1H SEMC-Browser/4.0.2 Profile/MIDP-2.0
> Configuration/CLDC-1.1"
> 213.229.249.42 - - [10/Nov/2005:11:50:45 +0100] "GET / HTTP/1.1" 500
> 601 "-" "SonyEricssonZ1010/R1H SEMC-Browser/4.0.2 Profile/MIDP-2.0
> Configuration/CLDC-1.1"
> 213.229.249.42 - - [10/Nov/2005:11:51:44 +0100] "GET / HTTP/1.1" 500
> 601 "-" "SonyEricssonZ1010/R1H SEMC-Browser/4.0.2 Profile/MIDP-2.0
> Configuration/CLDC-1.1"
>
> Apache error log:
> [Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
> PythonHandler test.portal.handler:   File
> "/usr/lib64/python2.4/site-packages/mod_python/Session.py", line 114,
> in __init__\n    cookies = Cookie.get_cookies(req)
> [Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
> PythonHandler test.portal.handler:   File
> "/usr/lib64/python2.4/site-packages/mod_python/Cookie.py", line 369,
> in get_cookies\n    return Class.parse(cookies, **kw)
> [Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
> PythonHandler test.portal.handler:   File
> "/usr/lib64/python2.4/site-packages/mod_python/Cookie.py", line 115,
> in parse\n    dict = _parse_cookie(str, Class)
> [Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
> PythonHandler test.portal.handler:   File
> "/usr/lib64/python2.4/site-packages/mod_python/Cookie.py", line 329,
> in _parse_cookie\n    setattr(c, l_key, val)
> [Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
> PythonHandler test.portal.handler: AttributeError: 'Cookie' object has
> no attribute '$version'
>
> Sebastjan
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>

Hi

I have the same problem with mobile devices. Changing line 329 in
/usr/lib/python2.4/site-packages/mod_python/Cookie.py from:

if (l_key in valid or key[0] == '$'):

to:

if (l_key in valid):

seems to resolve the problem for mobile devices, while not affecting
other browsers. Still, I don't know what other side effects may this
change have, as I didn't find anything about this problem on the net.

--
Robert Wallner



More information about the Mod_python mailing list