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

  # New 'NewsFolder' type based on folder
                       add_meta_type="Factory-based Type Information",
                       typeinfo_name="CMFPlone: Plone Folder")
  nf = getattr(types_tool, 'NewsFolder')
                           allowed_content_types=('News Item',))
  for a in actions:
      if == 'view':
          a.action = Expression('string:${object_url}/newsfolder_view')

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.


"Building Websites with Plone"

Enfold Systems, LLC
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to