[Zope-CMF] Re: adding items to the TALES namespace for actions

Tres Seaver tseaver at palladion.com
Sat Apr 8 14:29:48 EDT 2006

Hash: SHA1

Rocky Burt wrote:

> I'd like to add a new variable to the TALES namespace for all actions
> (for all existing action providers) on a CMF 1.6.0 site.  We basically
> have a view that provides some global vars that we'd like to expose.
> Does anyone know of a sensible way to do this without monkey patching
> CMFCore.Expression.createExprContext ?
> Or perhaps suggest a different way of accomplishing what we need?

The expression contexts for objects are cached in the request, so you
could attempt to preempt calling 'createExprContext' by jamming your own
context into that cache (e.g., during publishing traversal, or at least
before calling 'listFilteredActionsFor').

I originally intended to have the actiosn tool construct the context and
pass it in to the providers, which would have allowed you to customize
the contexts by replacing the actions tool.  I don't recall why we ended
up with the caching strategy we have now.

- --
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


More information about the Zope-CMF mailing list