You are here: Home Tech Create Plone 3 Archetype Product with ZopeSkel and Buildout

Create Plone 3 Archetype Product with ZopeSkel and Buildout

by Chris Shenton last modified Sep 05, 2009 01:15 PM
ZopeSkel can create Archetype-based products for Plone 3. Wire it up in Buildout.

After creating a Plone 3 instance (e.g., with Unified Installer) go into the src/ directory and create a development product with ZopeSkel:

> paster create -t archetype --svn-repository=https://svn.koansys.com/parentpath/
Enter title (The title of the project) ['Plone Example']: Koansys Newproduct
Enter namespace_package (Namespace package (like plone)) ['plone']: koansys
Enter package (The package contained namespace package (like example)) ['example']: newproduct
Enter zope2product (Are you creating a Zope 2 Product?) [False]: True
Enter version (Version) ['0.1']: 
Enter description (One-line description of the package) ['']: 
Enter long_description (Multi-line description (in reST)) ['']: 
Enter author (Author name) ['Plone Foundation']: 
Enter author_email (Author email) ['plone-developers@lists.sourceforge.net']: 
Enter keywords (Space-separated keywords/tags) ['']: 
Enter url (URL of homepage) ['http://svn.plone.org/svn/plone/plone.example']: 
Enter license_name (License name) ['GPL']: 
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: 

then go into that directory (koansys.newproduct) and add a content type:

> paster addcontent contenttype
Enter contenttype_name (Content type name ) ['Example Type']: Recipe
Enter contenttype_description (Content type description ) ['Description of the Example Type']: Recipe with ingredients, procedure, metadata
Enter folderish (True/False: Content type is Folderish ) [False]: True
Enter global_allow (True/False: Globally addable ) [True]: 
Enter allow_discussion (True/False: Allow discussion ) [False]: True

Modify your buildout.cfg to use these as development eggs and tell each instance about it's ZCML (otherwise it won't show up in the Quick Installer):

[buildout]
...
eggs =
    ...
    koansys.newproduct

develop =
    src/koansys.newproduct

[client1]
# maybe your section is called [instance] or some variation
recipe = plone.recipe.zope2instance
eggs =
    ${plone:eggs}
    ${buildout:eggs}
zcml = 
    shenton.recipes

Re-run buildout and restart your "client1" instance and you should see it in the Quick Installer.

 

It won't do much since you haven't defined any schemas, but it's gratifying to see it exists: better to start simple and work than complex and fail.

 

Now you can flesh out your product.

 

Careful with contenttype names with spaces

I encountered this in another application, so excuse the abrupt shift in content names. Others have noticed this and I updated that ticket with these notes.

Paster created a config.py for me with ADD_PERMISSIONS having my content types and permissions, but for content types with names containing a space, it left the space in the name, and this didn't match the name-sans-spaces that it was trying to use. For example, ADD_PERMISSIONS had:

    'Teens Feature Link': 'teens.content: Add Teens Feature Link',


which would cause:

    permission = config.ADD_PERMISSIONS[atype.portal_type],
KeyError: 'TeensFeatureLink'


but could be fixed by removing spaces from ADD_PERMISSIONS' key name:

    'TeensFeatureLink': 'teens.content: Add Teens Feature Link',



Share this: