[Zope] dtml sessions?

Chris McDonough chrism@zope.com
01 Sep 2002 23:47:53 -0400


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 )