[Zope] Cookie setting problem
Kit O'Connell
txpn@txpn.org
Mon, 18 Dec 2000 20:25:47 -0800 (PST)
I'm trying to set up a system like example 9 in the tutorial (new elvis
sightings) where new news stories in a specific folder are flagged 'New!'
if they've been modified or added since the last visit. Early on in the
document, I do the following while going through the folder's stories one
at a time with a <dtml-in>:
<dtml-if REQUEST.has_key('TXPNfront')>
<dtml-if "bobobase_modification_time() > ZopeTime(TXPNfront)">
- <font color="red">New!</font>
</dtml-if>
</dtml-if>
Unlike example 9, I want these tickets to be permanent, and have a Python
method someone on this list provided so that the expiration of each cookie
is set to 1 week from the date it is set. However, I need to reset the
cookie each visit, so it doesn't new-flag stories the user has already
seen, so I:
<dtml-if REQUEST.has_key('TXPNfront')>
<dtml-call "RESPONSE.expireCookie('TXPNfront')">
</dtml-if>
later in the document. Then:
<dtml-call "RESPONSE.setCookie('TXPNfront', ZopeTime(),
expires=expireIn1Week())">
I seem to be going about this the wrong way, however, as neither adding
new stories now editting existing ones results in the display of the
'New!' tag.
Any ideas on what I'm doing wrong?
Thanks,
Kit