[Twisted-web] Session trouble - solved

Michal Pasternak twisted-web@twistedmatrix.com
Wed, 17 Dec 2003 02:06:42 +0100


Michal Pasternak [Wed, Dec 17, 2003 at 12:47:12AM +0100]:
> My question is simple: how do I get around this?

After a short discussion with Donovan Prestion this issue has been quickly
solved with a bit different approach.

For list archives:

1) write a .tac script instead cached .rpy, like:

from twisted.application import service
from twisted.web import server
from twisted.application import internet
import yourWebModule

application = service.Application("theappname")

internet.TCPServer(8080,
		server.Site(yourWebModule.yourRootPageObject())
	).setServiceParent(application)

2) run the tac script like

	twistd -oy script.tac
	
3) remember, that you should _never_ store Session or it's values inside 
   your objects; always get it from request instead.

Please note, that this issue could be propably solved even when using .rpy
and cache(), only that I currently have no idea how to do it.

Regards,
-- 
Michal Pasternak :: http://pasternak.w.lub.pl :: http://winsrc.sf.net