[Zope] Cookies & Expiration

Steve Drees drees@the-bridge.net
Fri, 3 Nov 2000 16:01:46 -0600


> However, I'd like to have this cookie set to expire one week from the date
> of the current visit. i.e., if its 12:30 on 11/3 when a surfer visits my
> site, I want Zope to set their lastVisited cookie to expire on 12:30 on
> 11/10.

Have a pythonmethod

ID expireIn1Week
Parameter List self
_____________BODY__________
t = self.ZopeTime() + 7.0 # 1 week in the future
t = t.toZone('GMT')

return t.strftime("%A, %d-%b-%Y %H:%M:%S GMT")
___________________________


On the page you want to set the cookie put
<dtml-call "RESPONSE.setCookie('cookiename','cookievalue', path='/',
expires=expireIn1Week())">