I'm trying to set up something like is used in the Zope Elvis tutorial, where it sets a cookie to show when you last visited the site, so that I can flag certain articles as 'new'. 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. Any ideas? Thanks, Kit
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())">
On Fri, 3 Nov 2000, Steve Drees wrote:
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")
It (strftime) is correct as long as you don't use locales. (There's a bug related to this in ZServer/medusa/http_date.py.) ololo@zeus.polsl.gliwice.pl /--------------------------------------\ | `long long long' is too long for GCC | \--------------------------------------/
participants (3)
-
Aleksander Salwa -
Kit O'Connell -
Steve Drees