[Zope] dtml sessions?
Greg Conway
greg@gmlnt.com
Mon, 2 Sep 2002 05:25:56 +0100
Thanks Chris, Chris and Quentin!
But contrary to my earlier findings, it turns out the session var is not
staying in memory....
Does this mean I haven't got the necessary part of Zope installed?
The session item first comes up as follows:
SESSION id: 10309401531156298065, token: 42527132A0c0Y8rr7Ag, contents:
[('TrolleyQty', '1'), ('TrolleyStockNo', '4')]
but when I move to another form and view the request there, the session now
reads:
SESSION <Python Method object at 0x86292d0>
actually, the session appears under "lazy items" the second time around, do
I have to refresh it or something every time? in which case I could just
re-store the REQUEST var every time, but this seems a lot of hassle to do
this on every form!! or is it still there and I'm just not reading it
properly?
I cannot get the list function to work! but maybe sorting this out will sort
that out as well....
so have I just got something switched off I can switch on?
thanks all!
Regards,
Greg.
>> -----Original Message-----
>> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Chris
>> McDonough
>> Sent: 02 September 2002 04:48
>> To: Chris Beaven
>> Cc: Greg Conway; zope@zope.org
>> Subject: RE: [Zope] dtml sessions?
>>
>>
>> See also
>> http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/Sessions.stx
>> for exhaustive sessioning docs. These are written for 2.6 but mostly
>> work under 2.5.
>>
>> On Sun, 2002-09-01 at 23:41, Chris Beaven wrote:
>> > Would have actually been better to do this with the python script:
>> >
>> >
>> > request = container.REQUEST
>> > session = request.SESSION
>> >
>> > stockno = session['StockNo']
>> > stockno.append(request['TrolleyStockNo'])
>> > session.set('StockNo:list', stockno)
>> >
>> > qty = session['Qty']
>> > qty.append(request['TrolleyQty'])
>> > session.set('Qty:list', qty)
>> >
>> >
>> > -----Original Message-----
>> > From: Chris Beaven [mailto:Chris@d-designz.co.nz]
>> > Sent: Monday, 2 September 2002 3:37 p.m.
>> > To: Greg Conway; zope@zope.org
>> > Subject: RE: [Zope] dtml sessions?
>> >
>> >
>> > You'll have to get the list, add the item, and then put it back:
>> >
>> >
>> > <dtml-call
>> "REQUEST.SESSION.set('StockNo:list',REQUEST.SESSION['StockNo'] +
>> > [TrolleyStockNo])">
>> > <dtml-call "REQUEST.SESSION.set('Qty:list',REQUEST.SESSION['Qty'] +
>> > [TrolleyQty])">
>> >
>> >
>> > Ugh it's about time to make that in a Python script:
>> >
>> >
>> > request = container.REQUEST
>> > session = request.SESSION
>> >
>> > stockno = session['StockNo'] + [request['TrolleyStockNo']]
>> > session.set('StockNo:list', stockno)
>> >
>> > qty = session['Qty'] + ['TrolleyQty']
>> > session.set('Qty:list', qty)
>> >
>> >
>> > Aah, much more readable :)
>> >
>> > -----Original Message-----
>> > From: Greg Conway [mailto:greg@gmlnt.com]
>> > Sent: Monday, 2 September 2002 3:27 p.m.
>> > To: Quentin Smith
>> > Cc: Zope@Zope. Org
>> > Subject: RE: [Zope] dtml sessions?
>> >
>> >
>> > Hi Quentin,
>> >
>> > That does indeed help, many thanks!
>> >
>> > Except... how do I get the variables to add themselves to each
>> in a list
>> > fashion?
>> >
>> > I expected this to work....
>> >
>> > <dtml-call "REQUEST.SESSION.set('StockNo:list',TrolleyStockNo)">
>> > <dtml-call "REQUEST.SESSION.set('Qty:list',TrolleyQty)">
>> >
>> > ...but instead got some variables called StockNo:list and
>> Qty:list who's
>> > values were replaced by every interation, not added to!
>> >
>> > Regards,
>> >
>> > Greg.
>> >
>> > >> -----Original Message-----
>> > >> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
>> > >> Quentin Smith
>> > >> Sent: 02 September 2002 04:04
>> > >> To: Greg Conway
>> > >> Cc: Zope@Zope. Org
>> > >> Subject: Re: [Zope] dtml sessions?
>> > >>
>> > >>
>> > >> Hi-
>> > >> Most new Zope installs come with a session manager in the
>> root folder,
>> > >> and a temporary folder with a session data container. All
>> you have to do
>> > >> is use REQUEST.SESSION.set() instead of REQUEST.set().
>> > >> HTH,
>> > >> --Quentin
>> > >> On Sunday, September 1, 2002, at 10:59 PM, Greg Conway wrote:
>> > >>
>> > >> > Hi all,
>> > >> >
>> > >> > Just wondering, does Zope (I'm using 2.5.0) have built-in session
>> > >> > support?
>> > >> >
>> > >> > I have just discovered that my REQUEST variables don't
>> stay in memory!
>> > >> > so I
>> > >> > just need something that will store a variable in memory
>> regardless of
>> > >> > traversing through forms!
>> > >> >
>> > >> > I guess that this means sessions sessions or cookies, not
>> really sure
>> > >> > about
>> > >> > either of them, and preliminary findings indicate I may need
>> > >> to add more
>> > >> > stuff into Zope to get sessions working!
>> > >> >
>> > >> > So if there is any easy way of doing this, can somebody please
>> > >> > enlighten me
>> > >> > before I go off at a lengthy tangent again to re-invent the wheel?
>> > >> >
>> > >> > :)
>> > >> >
>> > >> > many thanks!
>> > >> >
>> > >> > Regards,
>> > >> >
>> > >> > Greg Conway.
>> > >> >
>> > >> > This electronic transmission and any files attached to it
>> are strictly
>> > >> > confidential and intended solely for the addressee. If you are not
>> > >> > the intended addressee, you must not disclose, copy or
>> take any action
>> > >> > in reliance of this transmission. If you have received this
>> > >> > transmission in error, please notify us by return and
>> delete the same.
>> > >> > Further enquiries/returns can be posted to postmaster@gmlnt.com
>> > >> > Thank you.
>> > >> >
>> > >> > _______________________________________________
>> > >> > Zope maillist - Zope@zope.org
>> > >> > http://lists.zope.org/mailman/listinfo/zope
>> > >> > ** No cross posts or HTML encoding! **
>> > >> > (Related lists -
>> > >> > http://lists.zope.org/mailman/listinfo/zope-announce
>> > >> > http://lists.zope.org/mailman/listinfo/zope-dev )
>> > >> >
>> > >>
>> > >>
>> > >> _______________________________________________
>> > >> Zope maillist - Zope@zope.org
>> > >> http://lists.zope.org/mailman/listinfo/zope
>> > >> ** No cross posts or HTML encoding! **
>> > >> (Related lists -
>> > >> http://lists.zope.org/mailman/listinfo/zope-announce
>> > >> http://lists.zope.org/mailman/listinfo/zope-dev )
>> > >>
>> >
>> > This electronic transmission and any files attached to it are strictly
>> > confidential and intended solely for the addressee. If you are not
>> > the intended addressee, you must not disclose, copy or take any action
>> > in reliance of this transmission. If you have received this
>> > transmission in error, please notify us by return and delete the same.
>> > Further enquiries/returns can be posted to postmaster@gmlnt.com
>> > Thank you.
>> >
>> > _______________________________________________
>> > Zope maillist - Zope@zope.org
>> > http://lists.zope.org/mailman/listinfo/zope
>> > ** No cross posts or HTML encoding! **
>> > (Related lists -
>> > http://lists.zope.org/mailman/listinfo/zope-announce
>> > http://lists.zope.org/mailman/listinfo/zope-dev )
>> >
>> > _______________________________________________
>> > Zope maillist - Zope@zope.org
>> > http://lists.zope.org/mailman/listinfo/zope
>> > ** No cross posts or HTML encoding! **
>> > (Related lists -
>> > http://lists.zope.org/mailman/listinfo/zope-announce
>> > http://lists.zope.org/mailman/listinfo/zope-dev )
>> >
>> > _______________________________________________
>> > Zope maillist - Zope@zope.org
>> > http://lists.zope.org/mailman/listinfo/zope
>> > ** No cross posts or HTML encoding! **
>> > (Related lists -
>> > http://lists.zope.org/mailman/listinfo/zope-announce
>> > http://lists.zope.org/mailman/listinfo/zope-dev )
>>
>>
>>
>> _______________________________________________
>> Zope maillist - Zope@zope.org
>> http://lists.zope.org/mailman/listinfo/zope
>> ** No cross posts or HTML encoding! **
>> (Related lists -
>> http://lists.zope.org/mailman/listinfo/zope-announce
>> http://lists.zope.org/mailman/listinfo/zope-dev )
>>
This electronic transmission and any files attached to it are strictly
confidential and intended solely for the addressee. If you are not
the intended addressee, you must not disclose, copy or take any action
in reliance of this transmission. If you have received this
transmission in error, please notify us by return and delete the same.
Further enquiries/returns can be posted to postmaster@gmlnt.com
Thank you.