On 29/08/2010 06:34, Νίκος wrote:
On 28 Αύγ, 23:15, MRAB<pyt...@mrabarnett.plus.com> wrote:
On 28/08/2010 20:37, Íßêïò wrote:
On 22 Áýã, 10:27, Íßêïò<nikos.the.gr...@gmail.com> wrote:
On 16 Áýã, 14:31, Peter Otten<__pete...@web.de> wrote:
Íßêïò wrote:
# initializecookie
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 acookienames visitor with a value ofnikos
within.
So, i have to ask why the if fails?
Maybe it's because != != ==
Iwant ti if code block to be executed only if the browsercookienames
visitor fetched doesnt cotnain the vbalue of 'nikos'
Is there somethign wrong with the way i wrote it?
Please do help me with this too becaus eif i dont solve this my
website keeps count my each visit like iam a guest visitor!
Print out mycookie, repr(mycookie.value) (unless mycookie is None) and
repr(host). Then follow the code yourself to see whether the condition
is True.
print mycookie outputs 'None'
Thts weird because i check with the browser and the cookie is there!
Just because you can see it doesn't mean your code can.
print repr(host) outputs '78-236-176.adsl.cyta.gr'
repr(mycookie.value) (unless mycookie is None)
and also
print mycookie.value gives an error too. Maybe there is not a value
method?
If mycookie is None, then it's not surprising that doesn't have 'value'.
In summary, mycookie is None, so:
mycookie and mycookie.value != 'nikos'
is false (actually None, which is treated as false).
host == '78-236-176.adsl.cyta.gr', so:
re.search(r'(cyta|yandex|13448|spider|crawl)', host)
finds 'cyta' and the search returns a match.
false or false == false
blabla... isn't executed.
--
http://mail.python.org/mailman/listinfo/python-list