Evan Simpson wrote:
> The only way (right now) to search for a property in the order PARENTS
> mentions them is to do so explicitly, by looping through the elements of
> PARENTS and checking their 'aq_explicit' for the property.  Example Python
> snippet:
> for p in REQUEST['PARENTS']:
>     if hasattr(p.aq_explicit, propname):
>         return getattr(p, propname)
> raise AttributeError, propname

I think you might be missing an else: and a couple or three tabs. ;)

If I'm not wrong this should have a pretty elegant DTML equivalent:

<dtml-in PARENTS>
  <dtml-with aq_explicit only>
    <dtml-if propname>
      <dtml-return proname>
      <dtml-raise AttributeError><dtml-var propname></dtml-raise>

I'm not going to actually *test* it.  Whether it works is left as an
exercise to the reader.


-Michel Pelletier


Visit WikiCentral for the latest Zen:


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to