Thanks everyone,

You are right, it works fine with :
C._cookie['expires'] = 'Fri, 1 Jan 2010 12:00:00 +0200'
and NOT with :
C.setMaxAge(86400)

The cookie is still exists after quitting and restarting the browser.
I test it on IE 5.5 and netscape 4.08 browsers and IIS5.0 web server.
Maybe add "setExpires" to the Cookie class.


this new code works fine:

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._cookie['expires'] = 'Fri, 1 Jan 2010 12:00:00 +0200'
      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