Developing a Plone product part 1

I have to say, I am used to being able to pick up a new tool or environment and start digging behind the scenes without becoming too bewildered, but Plone has not been like that at all. I am very impressed at the front end, but there’s always something extra required. Python is new to me, and I am struggling with the terminology and so on.

So, I am going to record my progress in creating a Plone product. I am currently using Plone 3.2.2, developing on Windows but will be deploying on Linux.

Useful things I learned so far

#Run plone in the foreground, so that you can see the output and restart easily

C:\Plone>bin\plonectl.exe fg

#If you change a .py or .zcml file, you need to restart Plone to see your changes

#Changes to .pt files should show up immediately in foreground mode

#Changes to .xml files mean the product must be uninstalled and reinstalled  (I think via the front end Setup > Add-on products page is fine)

My planned product

I want the site users (Editors/Contributers) to be able to add content into the right hand column, without giving them Manager rights. My plan is this:

1. Create a new content type for this content.  This will simply have a few custom fields, and should not appear in navigation by default (this tutorial).

2. Create a portlet which displays any items of the new content type in the current folder. The portlet will be added at root level and carry through the site, so users simply add the new right hand content where they want it. If the users want specific right hand content for a single page, they would put the page in its own folder. (see next tutorial)

Getting Started

I am using paster to create the skeleton of my product. This creates a directory structure with all the required files. It is easiest if paster is in your path.  So, in the src directory:

paster create -t archetype anorakgirl.mycontent

And answer the questions that follow:

Enter title (The title of the project) ['Plone Example']: Anorakgirl MyContent Project
Enter namespace_package (Namespace package (like plone)) ['plone']: anorakgirl
Enter package (The package contained namespace package (like example)) ['example']: mycontent

Use paster to add the actual contentype

cd anorakgirl.mycontent
paster addcontent contenttype

Then use paster again to add some fields to the content type.

paster addcontent atschema

Again answer the questions. The module name in this case will be mycontent. Repeat the above to add whatever fields you need. Note that you get Title and Description for free, so don’t add those.

You’ve now done enough to see the product in action. So

Adding the product to the build environment

Add the following lines to buildout.cfg

develop =
eggs =  
zcml =

Run buildout.

Start plone (in foreground mode).

Login as an Administrator. Go to Site Setup > Add-on Products. The product should be listed under products to install. Install it.

Your new content type should appear on the Add New menu. The edit form should have all the fields you added. The standard view won’t be very pretty but that’s a job for another tutorial…

Next Time: creating a Plone portlet to display the new Content Type…

Leave a Reply

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