You are here: Home Plone products PythonProducts

PythonProducts (1.0beta2)

1
by olena last modified 2009-01-19
0.0
0.0
0.0
0.0
Released on 2006-06-14 by Rocky Burt for Plone 2.1, Plone 2.5, Zope 2.8, Zope 2.9 under GPL - GNU General Public License available for All platforms.
Software development stage: beta
A mechanism to construct Zope 2 products as regular python packages. This enables a python package to be deployed as a Zope 2 product using a similar strategy as Zope 3.
Description
A mechanism to construct Zope 2 products as regular python packages. This enables a python package to be deployed as a Zope 2 product using a similar strategy as Zope 3.
Source Control
http://codespeak.net/svn/z3/pythonproducts/
Requirements
  • Python 2.3.5 or higher in 2.3.x series
  • Zope 2.8 or 2.9
  • Five 1.2 or higher
Installing

Uses regular python distutils for installation. Simply run:

python ./setup.py install --home /some/path/to/zope_instance_home
Usage

Once pythonproducts has been installed, the standard practise of installing a python package as a Zope 2 product is as follows:

  1. edit (or create it if it doesn't exist already) $YOUR_PKG_SOURCE/configure.zcml and add the line <five:registerPackage package="." initialize=".initialize" />
  2. copy your python package to $INSTANCE_HOME/lib/python
  3. create a ZCML "slug" by creating the file $INSTANCE_HOME/etc/package-includes/yourpackage-configure.zcml and populating it with <configure package="yourpackage" />
Explanation of Usage

Step 1: Your python package needs to register itself as a Zope 2 product. This is accomplished by using the new registerPackage directive. This directive takes a (required) "package" attribute which declares any python package as a Zope 2 product (with "." meaning this package). Another (optional) attribute is the 'initialize' attribute. If this attribute is defined, a function with that name will be invoked in a traditional Zope 2 style with a ProductContext instance as the sole argument.

Step 2: Your python package needs to exist somewhere on PYTHONPATH. With Zope 2.8, $INSTANCE_HOME/lib/python is added to the PYTHONPATH so copying your python package there ensures its somewhere in PYTHONPATH. But really your python package could be copied to any directory that exists on PYTHONPATH (ie /usr/lib/python2.3/site-packages).

Step 3: The standard way of registering a package with Zope 3 is to create a ZCML "slug" in the $INSTANCE_HOME/etc/package-includes directory. This file can be called anything as long as it ends with "-configure.zcml".

Document Actions
Powered by Plone