Cookie not retrieving as it should in some cases

alister alister.nospam.ware at ntlworld.com
Fri May 2 04:19:44 EDT 2014


On Fri, 02 May 2014 01:11:05 -0700, Ferrous Cranus wrote:

> # retrieve cookie from client's browser otherwise set it try:
> 	cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE', '') )
> 	cookieID = cookie['ID'].value
> except:
> 	cookieID = str( time.time() )
> 	cookieID = cookieID[-3:]
> 
> 	cookie['ID'] = cookieID
> 
> 
> Many times i noticed that the script instead of retrieving the cookie ID
> value so to identify each visitor uniquely it insteads set its again.
> The same think also happens when someone comes to superhost.gr via a
> link from anothwe webpage
> 
> can somebody tell me why this is happening?
> is there some flaw in my code? Perhaps it can be written more
> efficiently?

I had a similar issue when using Beaker middleware for WSGI which was 
caused by me not specifying a location for the storage of the cookie 
database.



-- 
There is a multi-legged creature crawling on your shoulder.
		-- Spock, "A Taste of Armageddon", stardate 3193.9



More information about the Python-list mailing list