Storing things in the session from ZPT
How can I put something in a session from ZPT? I've tried: <div tal:define="session/foo request/foo"> <div tal:define="foo python:session['foo']=request['foo']"> Do I really have to write a python method just to assign a single value? Robert (Jamie) Munro
--On 24. Februar 2006 12:49:48 +0000 "Robert (Jamie) Munro" <jamie@textmatters.com> wrote:
How can I put something in a session from ZPT?
I've tried:
<div tal:define="session/foo request/foo"> <div tal:define="foo python:session['foo']=request['foo']">
Do I really have to write a python method just to assign a single value?
Did you consider reading the whole SESSIONS chapter in the Zope Book 2.7 edition? -aj
On 24 Feb 2006, at 12:49, Robert (Jamie) Munro wrote:
How can I put something in a session from ZPT?
I've tried:
<div tal:define="session/foo request/foo"> <div tal:define="foo python:session['foo']=request['foo']">
Isn't it <div tal:define="foo python:request.SESSION.set('foo', request['foo'])">
Do I really have to write a python method just to assign a single value?
Robert (Jamie) Munro _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
On 24 Feb 2006, at 12:49, Robert (Jamie) Munro wrote:
How can I put something in a session from ZPT?
I've tried:
<div tal:define="session/foo request/foo"> <div tal:define="foo python:session['foo']=request['foo']">
Isn't it <div tal:define="foo python:request.SESSION.set('foo', request['foo'])">
Doing this kind of logic from ZPT is evil :-(
Do I really have to write a python method just to assign a single value?
Yes, put all you logic in a python script. See Zope 3 views for an event cleaner way :-) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Robert (Jamie) Munro schrieb:
How can I put something in a session from ZPT?
I've tried:
<div tal:define="session/foo request/foo"> <div tal:define="foo python:session['foo']=request['foo']">
Do I really have to write a python method just to assign a single value?
No you can use the method for all the other work too... You should avoid application logic in your templates. You can do that but its ugly. stop-using-defines-ly Tino
participants (5)
-
Andreas Jung -
Chris Withers -
Peter Bengtsson -
Robert (Jamie) Munro -
Tino Wildenhain