[Zope-dev] Is there a function to get the object type?
Lennart Regebro
regebro at gmail.com
Wed Apr 12 11:57:02 EDT 2006
On 4/11/06, Takahashi, Michael <MTakahashi at oid.ucla.edu> wrote:
> I'm trying to write a function that checks to see if the current object is
> a 'Folder'.
several ways:
isinstance(object, Folder) # does not work in python scripts
or
object.meta_type == "Folder" # does work in python scripts
or
object.portal_type == "Folder" # if it's a CMF object.
or also:
if getattr(object, 'objectIds', None) is not None:
This doesn't check if it is a Folder, but if it implements an object
manager type interface, which may or may not be what you want. :)
Oh, and zope-dev is for development of Zope, not with zope. You should
ask in zope at zope.org.
--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
More information about the Zope-Dev
mailing list