[Zope3-dev] PEP 333 and Zope

Phillip J. Eby pje at telecommunity.com
Wed Nov 10 10:23:36 EST 2004


At 12:14 PM 11/10/04 +0100, Eckart Hertzler wrote:

>Ok, just now I checked in the application side.
>I tried to incorporate Philips suggestions (hopefully correctyl) and
>tried to streamline it a bit.

There's a bug in 'getHeaders()', it should use "line.split(':',1)", or else 
it will break when a header value includes a colon.

However, the startup is still incorrect, because it relies on 
'zope.app.server.main.run()', which is not going to be appropriate for use 
inside say, Apache or Twisted.

There needs to be a way to have an object that automatically handles any 
zope-specific startup, either through its module initialization, or by 
having it check when it's called.

It seems to me that basically, one needs a module or script like:

      from zope.app.wsgi import PublisherApp

      # ...code to get a database from somewhere

      my_app = PublisherApp(database)

Then, this module could be used with any server.  The global 
'publisherApp', 'bootStrapSubscriber' and 'configure.zcml' should really 
all go away.

If it's inappropriate for the module to hardcode a database-finding 
mechanism, then an alternative is to add code to PublisherApp to let it 
find its own configuration and database using a WSGI configuration 
parameter, the first time it needs to.

For example, suppose we say that ZOPE3_CONFIG is an environment variable or 
server configuration variable, then it could use this to load the startup 
.zcml and determine the database.



More information about the Zope3-dev mailing list