Kai Hoppert wrote at 2004-8-2 14:04 +0200:
>i actually have a Problem with restrictedTraverse and hasattr.
>
>Object1
> Object2
> Object3
>
>
>I want to test if there exists a Object in Object3 wich has the same id and meta type
>how Object2 (id=myobject).
>so i ask
>
>Object3.restrictedTraverse('myobject',None) or
>
>hasattr(Object3,'myobject')
>
>i every time get's true back.
You can write a Script(Python) "hasattr_unacquired"
with parameters "obj, attr" and body
return hasattr(obj.aq_inner.aq_explicit, attr)
Note that a solution without the "aq_inner" will often work
but is not reliable...
--
Dieter
_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )