Cookie issue(cant fix it with anyhting)

Benjamin Schollnick benjamin at schollnick.net
Sun Oct 27 15:25:23 EDT 2013


Nikos,

Hello i having the following code to try and retrieve the visitor's
>> saved cookie form the browser.
>> 
>> [CODE]
>> # initialize cookie and retrieve cookie from clients browser try:
>>     cookie = cookies.SimpleCookie( os.environ['HTTP_COOKIE'] )
>>     cookieID = cookie['name'].value
>> except:
>>     cookieID = 'visitor'

As it has been said before, change the except to be an explicit error check.  
The all purpose except is hiding an error condition from you.

Take a look at this:

http://www.jayconrod.com/posts/17/how-to-use-http-cookies-in-python

	- Benjamin


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20131027/ba31cefb/attachment.html>


More information about the Python-list mailing list