Hello, list. I have a problem with my product. I use Zope 2.7.5 and Plone 2.0.5. I need to create the copy of Document content-type on my product's install the same way as it is done in portal_types via "Factory-based Type Information" option of dropdown. I just need to have the copy of it and to alter some fields. Please advise. Thank you. -- Best regards, Denis Mishunoff mailto:spliter@sdtcom.lg.ua http://plonetarium.objectis.net
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Denis Mishunoff wrote:
I have a problem with my product. I use Zope 2.7.5 and Plone 2.0.5.
I need to create the copy of Document content-type on my product's install the same way as it is done in portal_types via "Factory-based Type Information" option of dropdown. I just need to have the copy of it and to alter some fields.
Please advise. Thank you.
This is really a CMF question (zope-cmf@zope.org is the more appropriate list). You can create a FactoryTypeInformation instance, using the "CMFDefault.Document" template, but giving it a different ID; you can then modify the settings as you widh. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCtDhY+gerLs4ltQ4RAupOAKCI1dhQq6i6O2Abq6Hao9H6hUaOMQCfdKYr NYvbEUc/daREPrhNL96zryA= =Skod -----END PGP SIGNATURE-----
Denis Mishunoff wrote:
I have a problem with my product. I use Zope 2.7.5 and Plone 2.0.5.
I need to create the copy of Document content-type on my product's install the same way as it is done in portal_types via "Factory-based Type Information" option of dropdown. I just need to have the copy of it and to alter some fields.
Here's some code I stole from Chapter 8 of my book, were a Folder-derived type is created in an install script:: from Products.CMFCore.Expression import Expression # Customize types types_tool=getToolByName(portal,'portal_types') # New 'NewsFolder' type based on folder types_tool.manage_addTypeInformation(id='NewsFolder', add_meta_type="Factory-based Type Information", typeinfo_name="CMFPlone: Plone Folder") nf = getattr(types_tool, 'NewsFolder') nf.manage_changeProperties(filter_content_types=1, allowed_content_types=('News Item',)) actions=nf._cloneActions() for a in actions: if a.id == 'view': a.action = Expression('string:${object_url}/newsfolder_view') nf._actions=(actions) After a clone of the type is made based on Plone Folder, some changes are made: contents are filtered, and only News Items are allowed; also an action is changed to point to a custom template. This is a better option than using the copy/paste API like you might do in the ZMI. --jcc -- "Building Websites with Plone" http://plonebook.packtpub.com/ Enfold Systems, LLC http://www.enfoldsystems.com
Hello, J. You wrote 21 èþíÿ 2005 ã., 20:27:50:
Denis Mishunoff wrote:
I have a problem with my product. I use Zope 2.7.5 and Plone 2.0.5.
I need to create the copy of Document content-type on my product's install the same way as it is done in portal_types via "Factory-based Type Information" option of dropdown. I just need to have the copy of it and to alter some fields.
Here's some code I stole from Chapter 8 of my book, were a Folder-derived type is created in an install script::
from Products.CMFCore.Expression import Expression
# Customize types types_tool=getToolByName(portal,'portal_types')
# New 'NewsFolder' type based on folder types_tool.manage_addTypeInformation(id='NewsFolder', add_meta_type="Factory-based Type Information", typeinfo_name="CMFPlone: Plone Folder") nf = getattr(types_tool, 'NewsFolder') nf.manage_changeProperties(filter_content_types=1, allowed_content_types=('News Item',)) actions=nf._cloneActions() for a in actions: if a.id == 'view': a.action = Expression('string:${object_url}/newsfolder_view') nf._actions=(actions)
After a clone of the type is made based on Plone Folder, some changes are made: contents are filtered, and only News Items are allowed; also an action is changed to point to a custom template.
This is a better option than using the copy/paste API like you might do in the ZMI.
--jcc
Thank you very much, Cameron. Definitelly will use it next time. This time I decided to create the separate content type, because seems like I will need to change some methods of it. But I will definitelly use your solution next time ;) -- Best regards, Denis Mishunoff mailto:spliter@sdtcom.lg.ua http://plonetarium.objectis.net
participants (3)
-
Denis Mishunoff -
J Cameron Cooper -
Tres Seaver