> "setMaxAge()" name from the Java Servlet spec. You mention the 'expires'
> attribute, but I'm not even aware of this. O'Malley's module mentions RFC
In WebUtils/Cookie.py I found:
class Morsel(UserDict):
# RFC 2109 lists these attributes as reserved:
# path comment domain
# max-age secure version
#
# For historical reasons, these attributes are also reserved:
# expires
#
# This dictionary provides a mapping from the lowercase
# variant on the left to the appropriate traditional
# formatting on the right.
_reserved = { "expires" : "expires",
"path" : "Path",
"comment" : "Comment",
"domain" : "Domain",
"max-age" : "Max-Age",
"secure" : "secure",
"version" : "Version",
}
_reserved_keys = _reserved.keys()
So "expires" seems to be something deprecated. I followed your link
http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc2109.html and found:
10.1.2 Expires and Max-Age
Netscape's original proposal defined an Expires header that took a date
value in a fixed-length variant format in place of Max-Age:
Wdy, DD-Mon-YY HH:MM:SS GMT
Note that the Expires date format contains embedded spaces, and that "old"
cookies did not have quotes around values. Clients that implement to this
specification should be aware of "old" cookies and Expires.
> So try passing an integer to setMaxAge() and let us know how that
> works for
> you:
>
> cookie.setMaxAge(30*24*60*60) # expire in 30 days
No, it didn't. I'll stick with "expires" for now. BTW: I use MSIE 5.5.
Best regards
Franz
> -----Ursprüngliche Nachricht-----
> Von: Chuck Esterbrook [mailto:echuck@...]
> Gesendet: Sonntag, 01. April 2001 19:47
> An: fgeiger@...; Webware-discuss
> Betreff: Re: [Webware-discuss] Webware 0.5 and Cookies: How to use
> setMaxAge()?
>
>
> At 06:59 PM 4/1/2001 +0200, F. GEIGER wrote:
> >Hi all,
> >
> >to have cookies lasting longer than a session does, I had to set
> >"expires=dd-MMM-YYYY" where - and that's kind of strange -
> dd-MMM-YYYY could
> >be a date in the past, e.g. "01-Jan-2001".
> >
> >Class WebKit/Cookie does not provide a method "setExpires()" or
> >"setExpiryDate()", so I had to write
> >
> >cookieUser = Cookie('cookieUserName', "%s %s" % (user.addressNameFirst(),
> >user.addressNameLast()))
> >cookieUser._cookie['expires'] = "01-Jan-2001"
> >
> >Is the intention of class Cookie, that it is subclassed by me?
> >
> >There is a method setMaxAge(). I did not find a description for
> max-age as I
> >did for expires (found it in "ASP in a Nutshell"). How has
> setMaxAge() to be
> >used? I tried setMaxAge("02-Apr-2001") and setMaxAge("+1d").
>
> Regarding your subclassing question, the answer is No, it is not our
> intention that you should have to subclass Cookie in order to set
> standard
> attributes or do typical things.
>
> WebKit.Cookie.setMaxAge() is a bit of a "pass through" method whose
> implementation simply sets the "max-age" attribute of the
> underlying cookie
> implementation.
>
> def setMaxAge(self, maxAge):
> self._cookie['max-age'] = maxAge
>
> I got 'max-age' from Tim O'Malley cookie module. I borrowed the
> "setMaxAge()" name from the Java Servlet spec. You mention the 'expires'
> attribute, but I'm not even aware of this. O'Malley's module mentions RFC
> 2109, so I searched for it on Google.com:
> http://www.google.com/search?q=RFC+2109
>
> And found the first copy here:
> http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc2109.html
>
> It defines Max-Age like so:
>
> Max-Age=delta-seconds
> Optional. The Max-Age attribute defines the lifetime of the cookie, in
> seconds. The delta-seconds value is a decimal non- negative
> integer. After
> delta-seconds seconds elapse, the client should discard the
> cookie. A value
> of zero means the cookie should be discarded immediately.
>
>
> So try passing an integer to setMaxAge() and let us know how that
> works for
> you:
>
> cookie.setMaxAge(30*24*60*60) # expire in 30 days
>
>
> -Chuck
>
>
|