[Zope] Cookies and Python Scripts
seb bacon
seb@jamkit.com
19 Mar 2002 11:52:28 +0000
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 )