[Zope] Dynamic dictionary keys?

Andreas Pakulat apaku at gmx.de
Mon Feb 27 12:15:14 EST 2006


On 27.02.06 09:56:49, Andrew Hedges wrote:
> Allow me to preface this by saying I am a complete newbie to Zope (I prefer to 
> think of it as beginner's mind...).  What I am attempting to do is dynamically 
> add items to a dictionary, but Zope complains "keyword can't be an expression". 
>  Here's the reduced case of my code:
> 
> <dtml-let eventsDict="{}">
>    <dtml-let calstart="somestring">
>       <dtml-call "REQUEST.set(eventsDict[calstart]=id)">
>    </dtml-let>
> </dtml-let>

First let me tell you: Write a python script for things like this, it
really belongs into one.

Second thing: your dtml-call has a serious error, eventsDict[..]=id is
executed but it doesn't produce anything so set is called with no
parameters and this is wrong. set needs 2 parameters, one beeing a
string as the key and a second as the value which can be of any type
python knows.

I also don't get what this snippet should do?

Andreas

-- 
Today is the first day of the rest of your life.


More information about the Zope mailing list