Problem checking an existing browser cookie

Peter Otten __peter__ at web.de
Mon Aug 16 07:31:31 EDT 2010


Νίκος wrote:

> # initialize cookie
> cookie = Cookie.SimpleCookie()
> cookie.load( os.environ.get('HTTP_COOKIE', '') )
> mycookie = cookie.get('visitor')
> 
> if ( mycookie and mycookie.value != 'nikos' ) or re.search( r'(cyta|
> yandex|13448|spider|crawl)', host ) is None:
>     blabla...
> ========================
> 
> I checked and Chrome has a cookie names visitor with a value of nikos
> within.
> So, i have to ask why the if fails?

Maybe it's because != != ==




More information about the Python-list mailing list