SearchWiki:
  8 User(s) Active on Site
  233 Wiki Pages

Most Recently Modified

Club Resources (edit)

How This Wiki Works

Meeting space complements of:
Computer books
            and technical books at discount prices
Check them out; they are a great source of technical books at very good prices!

If you have shopped at Nerdbooks.com, help them out by reviewing them at ResellerRatings.com. You will need your invoice number to prove you are a real customer, and not just ballot stuffing.
Recent Changes Printable View Page History Edit Page
Content Last Modified on October 25, 2005, at 01:36 AM CST

<< | ZopePackages | Define the interface(s) >>


Where do I put my new package?

In building something, it's always good to know where you stand, where to begin storing your work. Zope packages are simply Python packages, typically a directory located somewhere along the Python import path (PYTHONPATH).

While placing your package on that path means Python can import it, Zope 3 uses no magical package detection facility and won't know about it until a special descriptor file (<package>-configure.zcml) is dropped into the "etc/package-includes/" directory of a particular instance of Zope.

Typically Zope packages are placed underneath a "Zope 3 package root", of which there are several.

{zope3-checkout-directory}/src/
If you installed Zope 3 from the official subversion source repository, packages can be installed under the "src" directory, and will then be available to all Zope website instances.
{zope3-software-install-directory}/lib/python/
If you installed Zope 3 from a tarball or other packaged distribution, packaged placed here will be available to all Zope website instances.
{zope3-instance-directory}/lib/python/
This is the directory you specified to the "mkzopeinstance" command and packages placed here are private to the given instance of Zope, which can be good for those under development.

In my case my instance directory is "~/zope3", so let's create a directory named "bookmarker":

  {jrush]# cd ~/zope3/lib/python
  [jrush]# mkdir bookmarker
  [jrush]# cd bookmarker

And then to make our new package "importable" to Python, create a nearly empty "__init__.py" file. I say nearly empty because while Python is happy with a completely empty file, some software distribution tools have trouble with empty files.

  [jrush]# cd ~/zope3/lib/python/bookmarker
  [jrush]# echo "# A Python Package" > __init__.py

<< | ZopePackages | Define the interface(s) >>

Recent Changes Printable View Page History Edit Page