Kevin Dangoor wrote:

>     I'm trying to check if the container from which the user selected a
> product from the add menu has an "acl_users" folder. When the user selects
> the option from the add menu, they get a form. When they submit the form,
> the method (a PythonMethod) does this:
> 
> folder=self.Destination()
> if hasattr(folder, 'acl_users'):
>   ...do something...
> else:
>   ...complain...
> 
> Even though I know the folder has an acl_users (and having this function
> return folder.objectIds() proves it), the above code will always complain.
> Is there a problem with using hasattr in this context?

Well, first of all, because of acquisition, if there's a acl_users at the
top level this will always return true.  Next, PythonMethods have trouble
with hasattr AFAIK - so instead do:

folder=self.Destination()
if 'acl_users' in folder.objectIds():
   ...do something...
else:
   ...complain...

-- 
Itamar S.T.  [EMAIL PROTECTED]   
"It don't get thingier than that!"

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

Reply via email to