Oops, forgot to send this one to the list... -----Original Message----- From: Eric Walstad [mailto:Eric@Walstads.net] Sent: Friday, November 03, 2000 3:40 PM To: Steve Drees Subject: RE: [Zope] Cookies & Expiration <Newbie_Alert> Hi Steve, Your solution is very cool! I'm going to use it in the following form... (maybe a bit more flexible?, change the default days to suit your needs) ID: expireInNDays Parameter List: self, days=1.0 _____________BODY__________ t = self.ZopeTime() + days # user defined duration 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=expireInNDays(this(), 7.0))"> or, to use the default of 1 day: <dtml-call "RESPONSE.setCookie('cookiename','cookievalue', path='/', expires=expireInNDays())"> Thanks -Eric. </Newbie_Alert> // -----Original Message----- // From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Steve // Drees // Sent: Friday, November 03, 2000 2:02 PM // To: Kit O'Connell; zope@zope.org // Subject: RE: [Zope] Cookies & Expiration // // // > 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())"> // // // // // _______________________________________________ // Zope maillist - Zope@zope.org // http://lists.zope.org/mailman/listinfo/zope // ** No cross posts or HTML encoding! ** // (Related lists - // http://lists.zope.org/mailman/listinfo/zope-announce // http://lists.zope.org/mailman/listinfo/zope-dev ) //