Plone tips

I’ve chosen Plone for a web application I’m working to develop, a collaborative site for educational assessment materials.  I have years of experience with PHP/LAMP and Java, but am pretty new to Python and very new to Plone.

As such, I’ve been having to figure out a lot along the way and I thought I should share some of what I’ve learned to save others the trouble.  Plone 3.2 introduced some big improvements to the Plone build system recently that make it much easier to get started with and that aren’t in any books yet.  (My copy of Professional Plone Development by Martin Aspeli covers Plone 3, but not 3.2. Plone’s doc on how to upgrade to 3.2 only helped a little.  )

The PSU WebLion wiki has been very helpful.  They have a great description of what a Buildout is, among other helpful info.  That’s where I found the this blog entry on building out with Plone 3.2.x, which now packages Plone as Python eggs.

Here’s a minimal buildout procedure:

$ mkdir plone3.2_buildout
$ cd plone3.2_buildout
$ wget*checkout*/zc.buildout/trunk/bootstrap/
$ cat > buildout.cfg
extends =
versions = versions
find-links =
parts = 

recipe = plone.recipe.zope2install
url = ${versions:zope2-url}
fake-zope-eggs = true

recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
user = admin:admin
http-address = 8080
eggs = 
$ python2.4
$ bin/buildout


For any other Plone products you use, check to see if they’re in Pypi.  If so, you can just add them to the list of eggs in the instance.  If your favorite product isn’t in egg form, consider nudging the developers. Plone recommends all Products become eggs and it’s easy to do. I know hardly anything about Plone and was able to convert the ECQuiz product to an egg.  If you want that egg you can just add "Products.ECQuiz" under "Plone" in your instance:eggs list. (Tip for converters:  if you get "unbound prefix" from configure.zcml you probably need this line,

    xmlns:genericsetup="" )

I’m also making edits to the ECQuiz code so it’s a little more complicated, but only barely.  I keep the code in src/ and I added the buildout.eggtractor extension to my buildout.cfg which scans the src directory for product eggs and automatically adds the appropriate values to the buildout.  Add it like so,

  extends =

  versions = versions


  extensions =

If you get, "Error: Missing option: buildout:develop" you also need a "develop = " option to [buildout].  For more on buildout, try the Buildout Quick Reference card.

Now let’s say you want to check your new site into Subversion.  (This tip I got from Martin Aspeli’s slideshow on Extending and Customizing Plone 3.)  You don’t want to check your whole directory in because much of that is built out automatically.  Other developers don’t need it and likely won’t even work on their system because much of what is built out contains hard-coded paths to other files and executables.

So before checking all the files within your buildout, update the directory’s svn:ignore property to omit the stuff that doesn’t need to go into version control.  In your buildout directory run,

$ svn propset svn:ignore '
> eggs
> develop-eggs
> bin
> var
> parts
> .installed.cfg' .  # note period for current dir
$ svn add products buildout.cfg src README.txt
$ svn commit

Now someone else can check out that code and run "python" to generate the bin directory and then "bin/buildout’ to build out all the eggs and code.

If you’re building more than one Plone site, you can save disk space and unnecessary downloads by configuring your Buildout to use a shared directory.

$ mkdir -p ~/.buildout/downloads
$ mkdir -p ~/.buildout/eggs
$ cat > ~/.buildout/default.cfg
  eggs-directory = ~/.buildout/eggs

  download-cache = ~/.buildout/downloads

That’s all I got for now.  I hope that’s helpful.

2 thoughts on “Plone tips

  1. Pingback: Twitted by aleahmad

Comments are closed.