[Zope-dev] Is there a function to get the object type?

Takahashi, Michael MTakahashi at oid.ucla.edu
Mon Apr 10 19:11:06 EDT 2006


Thanks Aruna,

 

That returns all portal_types.  However I would like to see what the
current type of an object is.

 

For example, if I am currently here: /mysite/index.html

 

I would like to know that the current object is a 'Document'

 

And if I were here: /mysite/folder

 

I would like to know that the current object is a 'Folder'

 

 

Thanks,

 

Mike

 

 

________________________________

From: Aruna Kathiria [mailto:aruna at cignex.com] 
Sent: Monday, April 10, 2006 3:58 PM
To: Takahashi, Michael; zope-dev at zope.org
Subject: RE: [Zope-dev] Is there a function to get the object type?

 

Hello:

You can get the types from following function. Once you get the list of
the types of the object type, you can use it as you want.

 

ptypes = context.portal_types.objectValues()

 

sample script to test is:

 

-------------------------------

ptypes = context.portal_types.objectValues()

 

for ptype in ptypes:
 print ptype
return printed

------------------------------

 

 

With Regards, 
Aruna Kathiriya 
Sr.Consultant, 
CIGNEX Technologies, Inc 
T:    408.327.9900 x 306 
F:    408.273.6785 
E:    aruna at cignex.com 
U:    www.cignex.com 
"Implement IT Right" 

 

 

________________________________

From: zope-dev-bounces at zope.org [mailto:zope-dev-bounces at zope.org] On
Behalf Of Takahashi, Michael
Sent: Monday, April 10, 2006 3:47 PM
To: zope-dev at zope.org
Subject: [Zope-dev] Is there a function to get the object type?

Hi guys,

 

I'm trying to write a function that checks to see if the current object
is a 'Folder'.   

 

I am using this tutorial as a reference: 

 

http://plone.org/documentation/how-to/pre-populated-folder

 

To create a new content object, the following command is used:

 

parent.invokeFactory(id=id, type_name='Folder')
 
 
Is there a function that can check what type this newly created object
is? Obviously its 'Folder' in this example, but I'd like to be able to
get the type_name of an object returned anywhere in my site to see if it
is a 'Folder'. 
 
 
Thanks,
 
Mike
 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-dev/attachments/20060410/5aea7f13/attachment-0001.htm


More information about the Zope-Dev mailing list