[mod_python] Best way to logout a session

Shawn Harrison harrison at tbc.net
Fri Feb 11 15:39:15 EST 2005


Chris Jackson wrote [02/11/05 12:30 PM]:
> How would I do this?  Do you have an example?

Sorry, no example. You can write a JavaScript function that deletes 
cookies from the user's browser (or rather, sets the expy date for those 
cookies to some time in the past). Send the JavaScript function in the 
page that returns after the user clicks to logout, and in the <body> tag 
put

	<body onLoad="myCookieDeleter();">

or some such. Here are some links:

http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/
http://google.com/search?q=javascript+delete+cookies

> Note: I'm using mod_python.Session; I prefer server-side session
> management  instead of creating a javascript client cookie.

You seem to misunderstand mod_python.Session. It sets a cookie in the 
client -- that's how it tracks session without making ugly URLs.

Now that you mention it, I think you could do the same thing using 
mod_python.Cookie; no need to dive into JavaScript if you don't want to. 
Sorry, this is all off the top of my head. I think the name of the 
cookie set by m_p.Session is pysid (the session id). Just set the expy 
for that cookie to sometime in the past.

> 
> Also, Javascript code to start a new window(maximized) and close the
> previous window will do as well.

Yah.

-- 
________________
harrison at tbc.net


More information about the Mod_python mailing list