setting cookies in a python script? (OmniWeb issue)
On our Zope site (www.su.ualberta.ca), we have a splash page that lets users choose which version of the site they want to see. That page has links to two methods, each of which set two cookies: splash --> gets set to 'yes', this prevents the user from encountering the splash page on subsequent visits. bandwidth --> gets set to either 'high' or 'low', depending on which method they click through to. The code for one of the methods, "setBandwidthHigh", (the other is almost identical): <dtml-call "RESPONSE.setCookie('bandwidth', 'high', domain='su.ualberta.ca', expires='Wed, 19 Feb 2020 14:28:00 GMT')"> <dtml-call "RESPONSE.setCookie('splash', 'yes', domain='su.ualberta.ca', expires='Wed, 19 Feb 2020 14:28:00 GMT')"> <dtml-call "RESPONSE.redirect('index_html')"> The problem I have is with a browsers such as OmniWeb 4.0.5 (Mac OS X). OmniWeb adds the path of the method to the cookie, so the cookie gets listed in this form: domain: su.ualberta.ca path: /setBandwidthHigh name: bandwidth value: high Other browsers simply list the path as /, and work just fine. Omniweb doesn't work, because when index_html checks for the cookie, the cookie as listed doesn't show up because the path is too specific. Doing a <dtml-var REQUEST> shows no cookie entries under OmniWeb (unless I include the path in the URL- e.g. "www.domain/setBandwidthHigh/samplepage/". Instead, the splash page just comes back up. I'm still pretty new to Python, but I was thinking that if I put a form button on the page to select the site version, I could have a Python script execute when it clicked that set the cookie properly in OmniWeb (i.e., with a path of '/'). Can I set cookies from within a Python script? Any other suggestions to solve my problem?
On Fri, Sep 28, 2001 at 02:59:42PM -0600, Marc Dumouchel wrote:
The problem I have is with a browsers such as OmniWeb 4.0.5 (Mac OS X). OmniWeb adds the path of the method to the cookie, so [skip] have a Python script execute when it clicked that set the cookie properly in OmniWeb (i.e., with a path of '/'). Can I set cookies from within a Python script? Any other suggestions to solve my problem?
Why Python Script? Just set the cookie with explicit path in DTML. Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (2)
-
Marc Dumouchel -
Oleg Broytmann