Creating a new content-type with Archetypes in Plone 3 – checklist

This list is not intended as a in-depth tutorial to learn how to create new content-types in Plone (if you are looking for that, please check the Archetypes Developer Manual), but as a checklist to ensure you’ve not forgot any step.

  1. Create the skeleton of the package using paster -t plone.
  2. Add the package to your buildout.cfg, including the eggs, develop and zcml sections.
  3. Define your type interfaces using zope.schema.
  4. Implement the interface using Archetypes.
    1. Define the content-type fields using Archetypes.atapi.Schema.
    2. Bridge the getters and setters to attributes using atapi.ATFieldProperty.
  5. Define the security policies for the class attributes throught <require /> directives into your configure.zcml.
  6. Register the neccessary resources (images, css, javascript) into your browser/configure.zcml file, throught <browser:resource /> directives.
  7. Implement the main view of the object.
    1. Register a <browser:page /> into the browser/configure.zcml file, referencing the view class and the content-type interface.
    2. Write the implementation of the referenced class above, using Products.Five.browser.pagetemplatefile.ViewPageTemplateFile and defining any internal methods that you’ll need into the rendered templates later.
    3. Write the associated template, using ZPT.
  8. Write the GenericSetup install code for the new content-type:
    1. Register a extension profile into your configure.zcml, using a <genericsetup:registerProfile /> directive.
    2. Register the type into the portal_types tool throught a types.xml file.
    3. Specify the details for each type into the types/your-type-name.xml file.
    4. Write the package’s boilerplate code to initialize the content-type and create the factory functions.
    5. Write down your configuration data into a file.
    6. Assign add permissions to desired roles throught rolemap.xml.
    7. Register the type factory in the factorytool.xml file.

Thanks to Martin Aspeli for such a great book!

2 thoughts on “Creating a new content-type with Archetypes in Plone 3 – checklist

  1. Thanks erral! I’m from the “old school” and have not get used to paster boilerplate generating functions yet, but should definitely give them a try.

Leave a Reply

Your email address will not be published. Required fields are marked *