[Zope-CMF] [dev] Actions: lazy dict not working with DTML?
Dieter Maurer
dieter at handshake.de
Tue Aug 3 15:08:20 EDT 2004
yuppie wrote at 2004-8-2 18:21 +0200:
>Since last week listFilteredActionsFor() returns ActionInfo objects
>instead of dictionaries. I tried to implement ActionInfo as a lazy dict
>to defer expensive processing of TALES expressions.
What is a lazy dict?
>This seems to work with the ZPT skin, but not with the old DTML skin.
>
> <dtml-in user_actions mapping>
> <a href="&dtml-url;"><dtml-var name></a><br>
> </dtml-in>
>
>Looks like this code bypasses __getitem__, but I don't understand how
>this works because I'm not a C programmer and can't read the
>TemplateDict code.
This is unlikely.
With the "mapping" keyword, the object itself is pushed
onto the "TemplateDict" (it is a stack of namespaces);
without it, it is wrapped before pushing into a "ClientDict" (I think)
which maps "__getitem__" to "__getattr__".
The "TemplateDict"s "getitem" asks each namespace on its stack
for the name using its "__getitem__" until it succeeds or reaches
the end of the stack.
When you send me a code fragment showing how your
"lazy dict" looks and works in principle, I can try to
analyse the problem.
--
Dieter
More information about the Zope-CMF
mailing list