Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70868

Re: Cookie not retrieving as it should in some cases

Newsgroups comp.lang.python
Date 2014-05-02 09:15 -0700
References <e32fc1ac-9396-4a6d-948f-321242377826@googlegroups.com> <AyI8v.213287$Ey6.209207@fx24.am4> <53102702-028a-4885-990b-24ac2a693f9a@googlegroups.com>
Message-ID <790afedc-7c5e-4a7c-96a2-cd423e6874e2@googlegroups.com> (permalink)
Subject Re: Cookie not retrieving as it should in some cases
From Φώντας Λαδοπρακόπουλος <nikos.gr33k@gmail.com>

Show all headers | View raw


Τη Παρασκευή, 2 Μαΐου 2014 11:45:10 π.μ. UTC+3, ο χρήστης Φώντας Λαδοπρακόπουλος έγραψε:
> Τη Παρασκευή, 2 Μαΐου 2014 11:19:44 π.μ. UTC+3, ο χρήστης alister έγραψε:
> 
> 
> 
> > 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.
> 
> 
> 
> I have tried also to set the path of the cookie and the expiration date of the cookie so for them not to impose a problem but yet the situation remains the same.
> 
> 
> 
> # retrieve cookie from client's browser otherwise set it
> 
> try:
> 
> 	cookie = cookies.SimpleCookie( os.environ['HTTP_COOKIE'] )
> 
> 	cookieID = cookie['ID'].value
> 
> except KeyError:
> 
> 	cookieID = str( time.time() )
> 
> 	cookieID = cookieID[-3:]
> 
> 
> 
> 	cookie['ID'] = cookieID
> 
> 	cookie['ID']['path'] = '/'
> 
> 	cookie['ID']['expires'] = 3600 * 24 * 365	# 1 year from now
> 
> 	print( cookie.output() )	# send cookie to web client before headers
> 
> 
> 
> The cookie is properly set in my Chrome browser as i see form Chrome settings.
> 
> 
> 
> If someone visits for example ypsilandio.gr and then clicks superhost.gr from there then another cookie is also set with the same name 'ID' cusing a mess to the database hwich iam storing the visitor's based on the cookie i'am tryign to retrive from them.

Someone please suggest something?
This it troubling me for months.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Cookie not retrieving as it should in some cases Ferrous Cranus <nikos.gr33k@gmail.com> - 2014-05-02 01:11 -0700
  Re: Cookie not retrieving as it should in some cases alister <alister.nospam.ware@ntlworld.com> - 2014-05-02 08:19 +0000
    Re: Cookie not retrieving as it should in some cases Φώντας Λαδοπρακόπουλος <nikos.gr33k@gmail.com> - 2014-05-02 01:45 -0700
      Re: Cookie not retrieving as it should in some cases Φώντας Λαδοπρακόπουλος <nikos.gr33k@gmail.com> - 2014-05-02 09:15 -0700

csiph-web