What is a good way to handle cookies in Pylons?

I have seen several links saying that there is WSGI middleware for this, but I don’t know much about choosing a WSGI environment that processes cookies.

+4
source share
2 answers

You do not need anything special with pylons (0.9.7), all this comes out of the box:

from pylons import request, response #set a cookie response.set_cookie( cookiename , some_string, max_age=180*24*3600 ) #read a cookie request.cookies.get( cookiename ) #remove a cookie request.cookies.pop( cookiename, None ) 

Pylons uses Webob (request, response) - objects (webob.Request, webob.Response).

+8
source

.pop above should be

 response.delete_cookie('cookie_name') 
+6
source

All Articles