[mod_python] sessions don't work

Dmitriy Kurilov dmkurilov at mail.ru
Wed Jan 12 07:38:01 EST 2005


> 
> Hello!
> 
> I'm getting started to learn modpython. I have done everything as said in docs.
> 
> 
> So, I can use apache and util, but when I'd tryed to use Session:
> ================================================
> from mod_python import apache
> from mod_python import util
> from mod_python import Session
> 
> def handler(req):
>         sess=Session.Session(req)
>         req.content_type = "text/html"
>         fk = util.FieldStorage(req)
>         req.write("OK")
>         return apache.OK
> ================================================
> 
> 
> 
> I get error:
> ================================================
> Mod_python error: "PythonHandler new"
> 
> Traceback (most recent call last):
> 
>   File "/usr/local/lib/python2.3/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
>     result = object(req)
> 
>   File "/usr/local/www/billing/new/new.py", line 23, in handler
>     req.content_type = "text/html"
> 
> AttributeError: 'module' object has no attribute 'BaseSession'
> ================================================
> 
> 
> 
> 
> Temporally, I've solve this problem by adding <input name="id" type="hidden" value="%(id)s"> in every form on site. But it's not good solution.
> 
> Please, give me an advise how to solve this problem...

So, I've solved my little problem. The problem is the Apache was built without THREADS. I'd build one:
================================================
make WITH_THREADS=yes install clean
================================================
and everything began work fine. If someone  face this problem  I hope this may be usefull.

Luck!


More information about the Mod_python mailing list