[Zope] Syntax problem

Tino Wildenhain tino at wildenhain.de
Wed Mar 17 02:53:17 EST 2004


Hi Jeff,

Jeff Nielsen wrote:
> All,
> 
>  
> 
> I’m having a silly syntax problem again, and I can’t get it right. I’m 
> try to update a value in a list DetailBodyHeader at Index 
> DetailEditSection with the value in the variable BodyText. The following 
> statement executes without error, but doesn’t update the value:
> 
>  
> 
>     dtml-call 
> "REQUEST.set('DetailBodyHeader[DetailEditSection]',BodyHeader)"
> 
>  
> 
> Can someone point me in the right direction?

thats easy :-) I always recommend starting the interpeter
in a window and try out interactively the things described
in the python tutorial (in your distribution or on www.python.org
->Documentaton->Tutorial)

It should not take more then 2hours and helps you to avoid
such erm.. nonsense like above :-)

All you need to know is REQUEST works like a mapping (python
dictionary).

dbh=REQUEST.get('DetailBodyHeader')
dbh[DetailEditSection]=BodyHeader

RQUEST.set('DetailBodyHeader',dbh) # this could be ommited
due to the "in place" modification, but should not if
you want to use this method elsewhere in Zope, on a
persistent object for example.

Regards
Tino Wildenhain






More information about the Zope mailing list