(Read more interesting articles on Plone here.)
Creating a theme package with ZopeSkel
Now that we have examined someone else’s theme, let us try creating our own.
Remember, we will not cover theme creation in depth; this is only a sample for site administrators (who may or may not be required to develop themes, in addition to managing their site).
For more information about creating themes, Visit: http://plone.org/documentation/kb/how-to-create-a-plone-3-theme-product-on-thefilesystem.
To create a theme, we will use the ZopeSkel tool (http://pypi.python.org/pypi/ZopeSkel) to generate some of the boilerplate code. ZopeSkel uses PasteScript (http://pypi.python.org/pypi/PasteScript) to facilitate package generation using a set of templates.
Other options include:
- Write everything by hand from memory
- Copy the contents of another theme package
- Use another tool such as ArchGenXML to generate boilerplate code (http://plone.org/products/archgenxml)
Adding ZopeSkel to a buildout
Now let’s add ZopeSkel to our buildout.
In 03-appearance-zopeskel.cfg, we have this:
[buildout]
extends = 03-appearance-zopepy.cfg
parts +=
zopeskel
[zopeskel]
recipe = zc.recipe.egg
dependent-scripts = true
We extend the previous working configuration file, and add a new section called zopeskel.
This section uses the zc.recipe.egg recipe (http://pypi.python.org/pypi/zc.recipe.egg) to download ZopeSkel from the Python Package Index (zc.recipe.egg will search the Python Package Index for packages that match the section name zopeskel).
We set dependent-scripts to true, to tell Buildout to generate Python scripts for ZopeSkel’s dependencies such as PasteScript, which includes the paster script.
Now stop Plone (with Ctrl + C or Ctrl + Z/Enter) and run Buildout:
$ bin/buildout -c 03-appearance-zopeskel.cfg
You should see:
$ bin/buildout -c 03-appearance-zopeskel.cfg
Uninstalling plonesite.
Updating zope2.
Updating fake eggs
Updating instance.
Installing plonesite.
…
Updating zopepy.
Installing zopeskel.
Getting distribution for ‘zopeskel’.
Got ZopeSkel 2.16.
Getting distribution for ‘Cheetah>1.0,<=2.2.1’.
…
Got Cheetah 2.2.1.
Getting distribution for ‘PasteScript’.
Got PasteScript 1.7.3.
Getting distribution for ‘PasteDeploy’.
…
Got PasteDeploy 1.3.3.
Getting distribution for ‘Paste>=1.3’.
…
Got Paste 1.7.3.1.
Generated script ‘/Users/aclark/Developer/plone-site-admin/
buildout/bin/
zopeskel’.
Generated script ‘/Users/aclark/Developer/plone-site-admin/
buildout/bin/
paster’.
Generated script ‘/Users/aclark/Developer/plone-site-admin/
buildout/bin/
easy_install’.
Generated script ‘/Users/aclark/Developer/plone-site-admin/
buildout/bin/
easy_install-2.4’.
You will notice that in addition to bin/zopeskel, Buildout also installed the “dependent scripts” bin/paster and bin/easy_install (the latter of which we do not really need in this case).
Running ZopeSkel
Now try running ZopeSkel with the command:
$ bin/zopeskel
You should see:
Usage:
zopeskel <template> <output-name> [var1=value] … [varN=value]
zopeskel –help Full help
zopeskel –list List template verbosely, with details
zopeskel –make-config-file Output .zopeskel prefs file
…
This tells us we need to pick a template and output-name.
ZopeSkel goes on to list the available templates. They are:
archetype: |
A Plone project that uses Archetypes content types |
kss_plugin: |
A project for a KSS plugin |
plone: |
A project for Plone products |
plone2_theme: |
A theme for Plone 2.1 |
plone3_portlet: |
A Plone 3 portlet |
plone_app: |
A project for Plone products with a nested namespace |
plone_pas: |
A project for a Plone PAS plugin |
plone2.5_theme: |
A theme for Plone 2.5 |
plone3_theme: |
A theme for Plone 3 |
plone2.5_buildout: |
A buildout for Plone 2.5 projects |
plone3_buildout: |
A buildout for Plone 3 installation |
plone_hosting: Plone hosting: |
buildout with ZEO and Plone
|
recipe: |
A recipe project for zc.buildout |
silva_buildout: |
A buildout for Silva projects |
basic_namespace: |
A basic Python project with a namespace package |
nested_namespace: |
A basic Python project with a nested |
basic_zope: |
A Zope project< |