Problem checking an existing browser cookie

Nik the Greek nikos.the.gr33k at gmail.com
Tue Aug 31 04:07:56 EDT 2010


On 30 Αύγ, 20:50, MRAB <pyt... at mrabarnett.plus.com> wrote:
> On 30/08/2010 18:16, Nik the Greek wrote:
>
>
>
>
>
>
>
>
>
> > On 30 Αύγ, 19:41, MRAB<pyt... at mrabarnett.plus.com>  wrote:
> >> 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:
> >>           ...
>
> > I don't understand what are you trying to say
>
> > Please provide a full example.
>
> > You mean i should try it like this?
>
> > unless ( visitor and visitor.value == 'nikos' ) or re.search( r'(msn|
> > yandex|13448|spider|crawl)', host ) not None:
>
> > But isnt it the same thing like the if?
>
> My point is that the logic might be clearer to you if you think first
> about how you know when you _are_ the visitor.

Well my idea was to set a cookie on my browser with the name visitor
and a value of "nikos" and then check each time that cooki. if value
is "nikos" then dont count!

I could also pass an extra url string like http://webville.gr?show=nikos
and check that but i dont like the idea very much of giving an extra
string each time i want to visit my webpage.
So form the 2 solution mentioned the 1st one is better but cant come
into action for some reason.

Aprt form those too solution i cant think of anyhting else that would
identify me and filter me out of the actual guest of my website.

I'm all ears if you can think of something else.




More information about the Python-list mailing list