In Inigo, we utilizes Zope Component Architecture widely in our development process as it helps us in decoupling components in our system.
Anyway, lets get straight to the point of this post. Basically, what I'll go through in this post would be one method of hooking zope.component together with a configure.zcml into your current python project. It might not be the best way, but the simplest that I know of.
- You'll need to have these installed in your python environment:
- Your project is packaged as an egg (probably possible if not as an egg, but I never tried that)
In your project egg module directory, create a file called
configure.zcmlwith this content:
This file will be the starting point for your project's component registration
In your python project, probably right at the start of the main() function, add this:
from zope.configuration.xmlconfig import xmlconfig
from StringIO import StringIO
Thats it, and you now can use ZCA in your app like you do in Zope.