In a pylons web app, should a cookie be set from a model class or a controller?
Posted
by ensnare
on Stack Overflow
See other posts from Stack Overflow
or by ensnare
Published on 2010-03-07T15:38:00Z
Indexed on
2010/03/08
3:02 UTC
Read the original article
Hit count: 266
Trying to figure out the best way to do this:
Should I do something like:
def index(self):
if request.POST:
u = User(id)
u.setCookie() #All session logic in def setCookie()
Or set the cookie in the controller like:
def index(self):
if request.POST:
u = User(id)
response.set_cookie('session_key', u.session_key, max_age=3600)
Why do it one way or the other? Thank you.
© Stack Overflow or respective owner