Installing the product
Congratulations! You have created your first Archetypes-based content type.
Let's add it in our already configured Zope instance to see what it looks like.
Instead of using the ArchGenXML product as it is, we will wrap it in an egg structure and install it in the src
folder of our buildout.
How to do it…
First of all, we must create the egg structure that will hold the ArchGenXML generated code:
- Go to your
buildout
folder and create — if not created yet — asrc
folder.mkdir ./src
- Then call
paster
to create the egg folder structure:paster create -t plone
It will start a very short wizard to select some options for our product. Most important is the first one:
Add whatever you want to the remaining options or just hit Enter to each one.
Once finished, paster
should have created a folder structure like:
Products.poxContentTypes
+ docs
+ Products
+ poxContentTypes
...
- __init__.py
+ Products.poxContentTypes.egg-info
- dependency_links.txt
...
- README.txt
- setup.cfg
- setup.py
The new egg product is empty, but we already have some code that ArchGenXML has generated. So let's use it to make things work.
- Copy all the contents of
./models/poxContentTypes
inside your ArchGenXML folder, (not thepoxContentTypes
folder itself, but its contents) into thesrc/Products.poxContentTypes/Products/poxContentTypes
folder inside yourbuildout
folder. Some of the existing files will be overwritten, don't worry about them.We are done! We have a working content type. Now we should tell our Zope instance to be aware of it. To do that, modify the buildout and build the instance again.
- In the main
[buildout]
part, modify theeggs
parameter by adding a new line:[buildout] ... eggs = ... Products.poxContentTypes
- Given that our product is in development stage (that is, it's inside the
src
folder of our instance), we must also change thedevelop
parameter to tell our instance where to fetch its code from:[buildout] ... develop = src/Products.poxContentTypes
- Build your instance again and re-launch it:
./bin/buildout ./bin/instance fg
How it works…
Unfortunately, ArchGenXML doesn't create the egg structure together with the product. Neither does it allow us to use arbitrary namespaces. This is why we have chosen a simple word for the package name: poxContentTypes
that will be preceded by the Zope-ish Products
to create the final namespace: Products.poxContentTypes
.
Nevertheless we can still use ArchGenXML’s power to generate the necessary code and insert it into an egg structure we create ad-hoc with paster .