Thanks, I have already dug through these docs... What I didn't get --that
made me post here-- were the following two questions:
* Will an expiration date in the future make the cookie persistent? I
haven't tried this, because...
* How can I access other cookie properties from within webware? In the docs
I see the setCookie() method for request and response but this only seems be
changing values, not cookie properties. Can I do a cookie() and then
manipulate the cookie directly?
Thanks,
Costas
>From: "Aaron Held" <aaron@...>
>To: "Costas Malamas" <costasm@...>,
><webware-discuss@...>
>Subject: Re: [Webware-discuss] newbie question on cookies (Another one!)
>Date: Thu, 6 Dec 2001 09:34:40 -0500
>
>The cookies are being handled by a few classes in the WebUtils component of
>webware.
>See the http://webware.sourceforge.net/Webware/Docs/ and click components
>
>The dosc for WebUtils point you to look at the source of the cookie class
>so..
>go to the class list you can view the summaries of the source code for the
>cookie handling classes
>http://webware.sourceforge.net/Webware/WebUtils/Docs/Source/ClassHier.html
>
>The docstring of the main cookie class it there
>http://webware.sourceforge.net/Webware/WebUtils/Docs/Source/Files/Cookie.py.html
>
>but it does not cover what you are asking for.
>Digging in the source I notice the _getdate routint that takes an offset
>value in seconds
>
># 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.Cracker
> >>> C = WebUtils.Cracker.SimpleCookie()
> >>> C["name"]='aaron'
> >>> C["name"]["Expires"]=300
> >>> C
>Set-Cookie: name=aaron; expires=Thu, 06-Dec-2001 14:33:5
>
>
>-Aaron
>
>
>
>----- Original Message -----
>From: "Costas Malamas" <costasm@...>
>To: <webware-discuss@...>
>Sent: Thursday, December 06, 2001 10:53 AM
>Subject: RE: [Webware-discuss] newbie question on cookies (Another one!)
>
>
> >
> > I'd like to expand this question (sorry for the cut&paste, I just joined
> > this list to get this answer :-)
> >
> > If this is the case, how can you create a persistent cookie on the
>client?
> > I would like to use it just to identify the user, not authorize her.
> >
> > Thanks in advance --and since it's my first post here, thanks for
>Webware!
> >
> > Costas
> >
> >
> > ------
> > FROM: markus jaisDATE: 12/05/2001 15:36:33
> > SUBJECT: RE: [Webware-discuss] newbie question on cookies
> >
> > hello
> > thanks, this explains the behavior
> >
> > is there a way to make it last for a specified amount of time.
> > for example, with Perl's CGI.pm I can specify a string like "+2M",
> > which means, that the cookie should stay on disk for 2 month
> >
> > I did not find anything like this in the sources.
> >
> > markus
> >
> >
> >
> > On Wednesday 05 December 2001 23:44, Aaron Held wrote:
> > >by default it should be a session cookie, which only lives for the
>duration
> > >of the browser session, they are not written to disk
> > >
> > >-Aaron
> > >----- Original Message -----
> > >From: "markus jais" <<EMAIL: PROTECTED>>
> > >To: <<EMAIL: PROTECTED>>
> > >Sent: Wednesday, December 05, 2001 5:16 PM
> > >Subject: [Webware-discuss] newbie question on cookies
> > >
> > > > hello
> > > > I have the following script:
> > > >
> > > > ----
> > > > from WebKit.Page import Page
> > > > class Hello(Page):
> > > > def writeBody(self):
> > > > self.writeln('Hello, world!')
> > > > #self.response().setCookie('col', 'red')
> > > > if self.response().hasCookie('col'):
> > > > c = self.response().Cracker('col')
> > > > h = "<h1 style=\"color:%s\"> python is great</h1>" % (c.value())
> > > > self.writeln(h)
> > > > else:
> > > > self.writeln("no cookie")
> > > > self.response().setCookie('col', 'blue')
> > > > ----
> > > >
> > > > the browser output is:
> > > > "Hello, world! no cookie "
> > > > when I reaload the page, the output stays the same.
> > > >
> > > > when I uncomment the line before the "if" statement, then the output
>is
> > > >
> > > > Hello, world!
> > > > python is great
> > > >
> > > > with the string "python is great" in red color.
> > > >
> > > > maybe may understanding of cookies in wrong, but I thougth that
> > > > after reloading, the cookie should be set and the "if" should be
>true
> > > > and the cookie should have the value "blue"
> > > >
> > > > when I look at
> > > > $HOME/.netscape/cookies I see no such cookie.
> > > >
> > > > maybe I am calling the wrong function.
> > > >
> > > > please tell me, if my understanding is just wrong, or if I am using
> > > > Webware incorrectly??
> > > >
> > > > thanks in advance
> > > >
> > > >
> > > > markus
> > > >
> > > >
> > > > --
> > > > Markus Jais
> > > > http://www.mjais.de
> > > > <EMAIL: PROTECTED>
> > > > The road goes ever on and on - Bilbo Baggins
> > > >
> > > > _______________________________________________
> > > > Webware-discuss mailing list
> > > > <EMAIL: PROTECTED>
> > > > https://lists.sourceforge.net/lists/listinfo/webware-discuss
> >
> > --
> > Markus Jais
> > http://www.mjais.de
> > <EMAIL: PROTECTED>
> > The road goes ever on and on - Bilbo Baggins
> >
> > _______________________________________________
> > Webware-discuss mailing list
> > <EMAIL: PROTECTED>
> > https://lists.sourceforge.net/lists/listinfo/webware-discuss
> >
> >
> >
> >
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at
>http://explorer.msn.com/intl.asp
> >
> >
> > _______________________________________________
> > Webware-discuss mailing list
> > Webware-discuss@...
> > https://lists.sourceforge.net/lists/listinfo/webware-discuss
>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|