Hi, I am experiencing cookie 'weirdness' on Zope (V 2.5.1b1)... I have two python scripts that are called from within a DTML Method. The first, py_cookie_read(foo) attempts to read an existing cookie and returns 1 if a value is present or 0 if the value is not present. The second, py_cookie_set(foo) attempts to overwrite the cookie with a new value after an action has been taken (voting in a poll). The code I use to read from the cookie is as follows: poll_cookie = context.REQUEST.cookie['poll'] And the code I use to set the cookie is as follows: context.REQUEST.RESPONSE.setCookie('poll', new_poll_cookie, expires=expiry) - where new_poll_cookie and expiry are variables set in the same script. The 'weirdness' that am I experiencing is that the cookie is rarely set and certainly never read properly. The few times that I have observed it in the REQUEST list - it has appeared under 'form' variables and 'other' variables but never 'cookie' variables. I think it may have something to do with the 'context' under which I am trying to set and read the cookies even though both scripts are called from within the same DTML Method - perhaps the cookie is only associated with individual python scripts? Any suggestions would be greatly appreciated... Cheers, Matt BTW - cookies are enabled in my browser :-) -- Matthew Anderson - Web Designer - Frontier Internet Services Limited Tel: 029 20 820 019 Fax: 029 20 820 037 http://www.frontier.net.uk Statements made are at all times subject to Frontier's Terms and Conditions of Business, which are available upon request.
on or about, Tuesday, March 19, 2002, we have reason to believe that Matthew Anderson wrote something along the lines of : MA> I am experiencing cookie 'weirdness' on Zope (V 2.5.1b1)... [snip].. MA> The 'weirdness' that am I experiencing is that the cookie is rarely set and certainly never read properly. The few times that I have observed it in the REQUEST list - it has appeared under 'form' MA> variables and 'other' variables but never 'cookie' variables. MA> I think it may have something to do with the 'context' under which I am trying to set and read the cookies even though both scripts are called from within the same DTML Method - perhaps the MA> cookie is only associated with individual python scripts? MA> Any suggestions would be greatly appreciated... just off the top of my head : try also adding a path='/' to the cookie definition, to make sure it is set for your whole site and not just a subtree.. Also, virtual hosting or running off different ports might influence cookie bahaviour. just possibilities.. :-) -- Geir Bækholt web-developer geirh@funcom.com funcom oslo | webdev-team
Someone alerted the list (yesterdat I think) to a bug in the latest Apache concerning cookies. If you are using Apache as your server this could be worth following up. seb On Tue, 2002-03-19 at 10:39, Matthew Anderson wrote:
Hi,
I am experiencing cookie 'weirdness' on Zope (V 2.5.1b1)...
I have two python scripts that are called from within a DTML Method. The first, py_cookie_read(foo) attempts to read an existing cookie and returns 1 if a value is present or 0 if the value is not present. The second, py_cookie_set(foo) attempts to overwrite the cookie with a new value after an action has been taken (voting in a poll).
The code I use to read from the cookie is as follows: poll_cookie = context.REQUEST.cookie['poll']
And the code I use to set the cookie is as follows: context.REQUEST.RESPONSE.setCookie('poll', new_poll_cookie, expires=expiry) - where new_poll_cookie and expiry are variables set in the same script.
The 'weirdness' that am I experiencing is that the cookie is rarely set and certainly never read properly. The few times that I have observed it in the REQUEST list - it has appeared under 'form' variables and 'other' variables but never 'cookie' variables.
I think it may have something to do with the 'context' under which I am trying to set and read the cookies even though both scripts are called from within the same DTML Method - perhaps the cookie is only associated with individual python scripts?
Any suggestions would be greatly appreciated...
Cheers,
Matt
BTW - cookies are enabled in my browser :-) -- Matthew Anderson - Web Designer - Frontier Internet Services Limited Tel: 029 20 820 019 Fax: 029 20 820 037 http://www.frontier.net.uk Statements made are at all times subject to Frontier's Terms and Conditions of Business, which are available upon request.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Matthew Anderson writes:
... The 'weirdness' that am I experiencing is that the cookie is rarely set and certainly never read properly. The few times that I have observed it in the REQUEST list - it has appeared under 'form' variables and 'other' variables but never 'cookie' variables. Never seen that (or heard about it):
You will always see the "cookie"s in "other", too. But I cannot believe that you see the cookie in "form" or "other" but not "cookie". As someone else already pointed out: cookie rules can be quite confusing, cookies are usually only send to part of a website, the part below the object that set the cookie -- unless you tell the browser otherwise with the "path" argument. Dieter
participants (4)
-
Dieter Maurer -
Geir B�kholt -
Matthew Anderson -
seb bacon