Problem checking an existing browser cookie

MRAB python at mrabarnett.plus.com
Mon Aug 30 12:41:52 EDT 2010


On 30/08/2010 04:33, Nik the Greek wrote:
> On 30 Αύγ, 06:12, MRAB<pyt... at mrabarnett.plus.com>  wrote:
>
>> This part:
>>
>>       ( not mycookie or mycookie.value != 'nikos' )
>>
>> is false but this part:
>>
>>       re.search( r'(msn|yandex|13448|spider|crawl)', host ) is None
>>
>> is true because host doesn't contain any of those substrings.
>
> So, the if code does executed because one of the condition is true?
>
> How should i write it?
>
> I cannot think clearly on this at all.
>
> I just wan to tell it to get executed  ONLY IF
>
> the cookie values is not 'nikos'
>
> or ( don't knwo if i have to use and or 'or' here)
>
> host does not contain any of the substrings.
>
> What am i doign wrong?!
>
It might be clearer if you reverse the condition and say:

     me_visiting = ...
     if not me_visiting:
         ...



More information about the Python-list mailing list