[Zope-CMF] is this tiny patch to CMFCore/Expression.py okay?

Dieter Maurer dieter at handshake.de
Mon Nov 29 13:51:19 EST 2004


Chris Withers wrote at 2004-11-29 03:52 +0000:
>Index: Expression.py
>===================================================================
>--- Expression.py       (revision 1038)
>+++ Expression.py       (working copy)
>@@ -105,6 +105,7 @@
>          'modules':      SecureModuleImporter,
>          'member':       member,
>          'here':         object,
>+        'context':      object.aq_parent,
>          }
>      return getEngine().getContext(data)
>
>It means you can get access to the acquisition context of the current 
>object in a nicely bound name, handy for doing things like:

-3:

  1. It uses "context" for something different from the "context"
     of Python Scripts (there "context" would be "object" and not
     "object.aq_parent").

  2. Accessing the acquisition parent via "aq_parent" is
     easy enough that no variable needs to be defined

  3. Access to the acquisition parent is a quite rare use
     case. No special variable is justified.

> ...
>string:{context/absolute_url}/some_script_that_twiddles_folder_properties

Are you sure, you need the acquisition parent (i.e. "object/aq_parent")
here and not the hiararchical parent (called "folder")?

-- 
Dieter


More information about the Zope-CMF mailing list