[mod_python] about use session

Lee jundong leejd80 at gmail.com
Sat Dec 11 03:02:26 EST 2004


I use session in mod_python. Unfortunately, I can't success.
My code is:
-----------------------------------------------------------------------------
#coding: UTF-8
from mod_python import apache
from mod_python.Session import Session

def Login (req):
    user = req.form["user"]
    password = req.form["password"]
    s = Session(req, timeout = 1)
    #if sess.is_new():
    #    util.redirect(req, 'http://www.mysite.com/login')
    return user,password
-----------------------------------------------------------------------------
Debug information display in browse:
-----------------------------------------------------------------------------
Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "E:\Zope\Python\Lib\site-packages\mod_python\apache.py", line
299, in HandlerDispatch
    result = object(req)

  File "E:\Zope\Python\Lib\site-packages\mod_python\publisher.py",
line 136, in handler
    result = util.apply_fs_data(object, req.form, req=req)

  File "E:\Zope\Python\Lib\site-packages\mod_python\util.py", line
361, in apply_fs_data
    return object(**args)

  File "E:/Project/GridGate/Source/sms\login.py", line 10, in Login
    # redirect to login

  File "E:\Zope\Python\Lib\site-packages\mod_python\Session.py", line
386, in Session
    timeout=timeout, lock=lock)

  File "E:\Zope\Python\Lib\site-packages\mod_python\Session.py", line
358, in __init__
    timeout=timeout, lock=lock)

  File "E:\Zope\Python\Lib\site-packages\mod_python\Session.py", line
132, in __init__
    Cookie.add_cookie(self._req, self.make_cookie())

  File "E:\Zope\Python\Lib\site-packages\mod_python\Session.py", line
165, in make_cookie
    if os.name == 'nt' and c.path[-1] == '\\':

IndexError: string index out of range

-----------------------------------------------------------------------------
-- 
My Blog >> http://leejd.cndev.org
My QQ >> 9847243


More information about the Mod_python mailing list