[Zope] Persistent Objects

bruno modulix bruno at modulix.org
Fri Apr 8 05:30:23 EDT 2005


Roy S. Rapoport wrote:
> A coworker of mine wrote his own web server framework from scratch for an
> internal application.  We're looking to migrate this application to Zope
> (thank God!).  The only question we need to deal with is:  
> 
> The reason he wrote his own webserver rather than use CGIs is that there
> was some processing that needed to happen to initialize a system state --
> basically, create an object that knows about the configuration of some
> things.  In his model, this object is created at the beginning and is
> simply shared among the various Python objects/modules that are invoked when
> responding to user requests.
> 
> How can I create such a persistent object that, say, a python script object
> or a page template could access?

Just write a Python product (there's a bit of boilerplate code, but 
that's pretty easy) that inherit from persitence.Persistant and can 
handle all that stuff, and instantiate one at the root of the 
application. ZODB will take care of the persistence, and acquisition 
magic will make this object accessible from all the application.

> (Sure, handholding on this would be nice, but what I'm actually expecting
> is answers along the lines of "look into <foo>")

Look into Product, ZODB, and acquisition !-)


-- 
Bruno Desthuilliers
Développeur
bruno at modulix.org


More information about the Zope mailing list