[Zope] how can I ask an object whether it is folderish?

Andrew Kenneth Milton akm@theinternet.com.au
Wed, 10 Oct 2001 20:52:00 +1000


+-------[ Andrew Kenneth Milton ]----------------------
| +-------[ Chris Withers ]----------------------
| | Try this:
| | 
| | if object.isFolderish():
| |  return "object is a folderish thang"
| | 
| | If it doesn't work, I'm sure I saw a method with a name kindof like that,
| | somewhere, once... urm...
| 
| if hasattr(object, isPrincipiaFolderish) and object.isPrincipiaFolderish:
|     print "object is Folderish."

oops...

if hasattr(object, 'isPrincipiaFolderish') and object.isPrincipiaFolderish:

I'm not sure how this differs from using getattr() when Acquisition comes in
though, but, this is the way it's done inside ObjectManager.

I'm pretty sure getattr will trigger the Acquisition machinery, I don't know
if hasattr does. Might be better to unwrap the object first before checking.

-- 
Totally Holistic Enterprises Internet|                      | Andrew Milton
The Internet (Aust) Pty Ltd          |                      |
ACN: 082 081 472 ABN: 83 082 081 472 |  M:+61 416 022 411   | Carpe Daemon
PO Box 837 Indooroopilly QLD 4068    |akm@theinternet.com.au|