[Zope-CMF] Cookies and paths (e.g. cookie being path-specific)

Reverend Matt rev_matt_y@yahoo.com
Tue, 12 Nov 2002 17:24:41 -0000


I am trying to set a global cookie for a site, and the cookie is only
working for the object at was set.

For example, I have a folder called Writings, with a bunch of CMF
Document objects in it.  Each Document has comments (Discussion Item
objects) as people have commented.  If someone comments on Document 1,
then anytime they reply to Document 1 the reply form remembers their
username, anytime they reply to any other documents or any other
comment under Document 1, it doesn't.

Relevant code to set cookie (added to discussion_reply script):
context.REQUEST.RESPONSE.setCookie('sitecomments',
context.REQUEST.form['username'], expires='Wed, 19 Feb 2020 14:28:00
GMT') 


Relevant code to get cookie:
<dtml-if "REQUEST.has_key('sitecomments')">
  value="<dtml-var sitecomments>"
<dtml-else>
value="anonymous"
</dtml-if>



I can look at the cookie set in my browser and it's there:
Name:sitecomments
Information:\"Testifcookieswork\"
host:localhost:8080
path:/Site/Writings/Article1
ServerSecure: no
Expires: 02/19/2020 08:28:00 AM