Thank you for this quick answer
I tried it but I have the same problem: the cookie is set only for a
session, if I start a new session the browser (IE5 or Netscape4) loses
the cookie
I'd like that the cookie stays 24h (86400s) on the browser

the new code:

from WebKit.Page import Page
from WebKit.Cookie import Cookie
from time import *

class CookieSessionTest(Page):
  
  def writeBody(self):
    
    if self.request().hasCookie('firstVisit'):
      firstVisit = self.request().cookie('firstVisit')
      self.writeln( "You've been here the first time at : %s <br>" %
firstVisit )
    else:
      firstVisit = asctime(localtime(time()))
      C = Cookie('firstVisit',firstVisit)
      C.setPath('/')
      C.setMaxAge(86400)
      C.setVersion(1)
      self.response().addCookie(C)
      self.writeln( "Welcome, this is your <font color=green>first
visit</font> <b>a cookie is stored on your computer</b>. It's now : %s
<br>" % firstVisit )

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to