Hi everyone,
I'm facing some problems handling cookies. I need to store and update a
value for non-auth users.
I need to do it throughout the session (this could be done with session
cookies) but also between different sessions. That's why I decided to use
cookies.

I tried to follow web2py books' instructions (
http://www.web2py.com/books/default/chapter/29/04/the-core#Cookies ), but
it does not work as expected.

My problem is that I just succeed to set the cookie value properly the
first time. My guess is that I do not fully understand the request/response

````
if not request.cookies.has_key('elocookie'):
    logger.debug("create ELO cookie")
    response.cookies['elocookie'] = (MU,PHI,SIGMA)
    response.cookies['elocookie']['expires'] = 72 * 3600
    response.cookies['elocookie']['path'] = '/'
else:
    value = request.cookies['elocookie'].value
    logger.debug('read ELO cookie %s'%str(value))
    mu,phi,sigma = [float(v) for v in
value.replace('(','').replace(')','').split(',')]


logger.debug("retrieved elo %s %s %s"%(mu,phi,sigma))
... #calculate mu,phi,sigma

response.cookies['elocookie'] = (mu,phi,sigma)

logger.debug("new cookie elo %s %s %s"%(mu,phi,sigma))
````

Could anyone tell me what I missed or misunderstood?
Thanks, Jon.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAK8tz32MinQjzboTAe8k8LHnL9aMurh1LjMe3_YdyBgeo-WhUg%40mail.gmail.com.

Reply via email to