> # The _getdate() routine is used to set the expiration time in > # the cookie's HTTP header. By default, _getdate() returns the > # current time in the appropriate "expires" format for a > # Set-Cookie header. The one optional argument is an offset from > # now, in seconds. For example, an offset of -3600 means > "one hour ago". > # The offset may be a floating point number. > > So to expire a cookie try something like: > > >>> import WebUtils.Cookie > >>> C = WebUtils.Cookie.SimpleCookie() > >>> C["name"]='aaron' > >>> C["name"]["Expires"]=300 > >>> C > Set-Cookie: name=aaron; expires=Thu, 06-Dec-2001 14:33:5
Thanks Aaron, I wish I had known it was that simple. I'm surprised it allows an upper case "E" on Expires and seems to convert to lower for the generated header. This is the code I use but had I known it allowed seconds, I would have used that for sure. c = Cookie(name,locals()[name]) #c.setMaxAge(30*24*60*60) # Doesn't cause the cookie to be saved to disk. expirationDate = DateTime.now() + DateTime.RelativeDateTime(months=+1) c._cookie['expires'] = expirationDate.Format("%A, %d-%b-%y %H:%M:%S GMT") -Jeff _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss