3 messages in com.googlegroups.pylons-discussquestoin on sessions
FromSent OnAttachments
jose29 Jun 2006 12:02 
Alexandre CONRAD29 Jun 2006 12:11 
Jose Galvez29 Jun 2006 14:58 
Subject:questoin on sessions
From:jose (jj.g@gmail.com)
Date:06/29/2006 12:02:28 PM
List:com.googlegroups.pylons-discuss

I am rewriting one of my old web applications to use pylons, I've installed one of the recent svn builds (a few days old now). the site makes heavy use of sessions, but I think I must be doing something wrong as I can't read the session once I've set it. Here is a real simple example of what does not work:

================================================================ from home2.lib.base import *

class SessController(BaseController): def index(self): return response('please user set and get')

def set(self): session['name'] = 'jose' return response('session set')

def get(self): name = session['name'] return response('you name is %s' % name)

=============================================================== so if I run localhost:5000/sess/set it looks like it works, however if I then try localhost:5000/sess/get I get an error: return self._session()[key] Module myghtyutils.session:135 in __getitem__ exceptions.KeyError: 'name' .

So am I using sessions correctly? or am I using them incorrectly, and if so how do you use sessions with pylons?