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

Dieter Maurer dieter at handshake.de
Sun Dec 5 12:55:24 EST 2004

Chris Withers wrote at 2004-12-4 17:52 +0000:
> ...
>As for Dieter's points 2 & 3, Florent actually answered both of those 
>;-)  The Acquisition.aq_parent function isn't available in expressions. 
>I think the closest you can get is "object.aq_parent or object"

You mean "object/aq_parent | object" (as path expression)?

   When "object.aq_parent" does not result in an "AttributeError 'aq_parent'",
   it is most likely what you are looking for.

> but is that enough?

Almost surely, unless you use objects that are not acquisition wrapped.

  I doubt that non acquisition wrapped objects are really useful
  as main object in an expression context -- unless you are
  using them outside Zope.

  But when your objects are not acquisition wrapped, "parent"
  makes no sense at all (at least with the implementation
  via acquisition).

  Therefore, we have another objection against the use of the
  term "parent": the proposed value bound to the name has
  nothing to do with the notion "parent" when the object is not
  acquisition wrapped.

>Florent suggested aq_parent(aq_inner(object)), but I think that's 
>already available through the name 'folder'.

I wrote that but I have been wrong:

  Actually "folder" is the nearest folder at or above "object" (or
  "None" if it is cannot be determined).

  Thus, often "folder" is the same as "aq_parent(aq_inner(object))"
  but not always. Especially, it is not when "object" is
  itself a folder.

However, I expect that in almost all use cases for your new
"parent" you could use "folder" instead. Am I right?


More information about the Zope-CMF mailing list