Chris Withers wrote:
Hey All,

I'm still continuing poking around (when I have the chance) to see how I'd get Zope running without ZODB.

Does the following line:

db =[0][0]


Note that there are two files, one for zope.server in and one for twisted.web2 in

...mean that Zope 3 is currently hard-coded to need a ZODB?


If so, how should we go about making this optional?

We would check if options.databases if empty. If that's so, we could set 'db=None'.

The 'db' object (the database) gets passed a long to the ServerTypes which pass it along to the WSGIPublisherApplication which then passes it along to the request/publication factory. This way, when a new request is created and a publication object with it, the publication has the database to start traversal off of. As far as I can see it, the publication is the only component in that whole chain that expects the 'db' object NOT to be None. So, you'd have to write your own publication that wouldn't use the 'db' object for a traversal root but your own custom object, e.g.:

class MyPublicationMixin(object):
    """Mix this in with BrowserPublication, HTTPPublication, etc."""

    def getApplication(self, request):
        stack = request.getTraversalStack()
        if '++etc++process' in stack:
            return applicationControllerRoot

        myroot = RootObject()
        return ProxyFactory(myroot)

(I am willing to put the work in to make this happen if people give me some hints...)

Changing and .twisted.main to accept an empty database section in zope.conf and thus set 'db=None' would probably be all that's needed, plus your custom publication that ignores the 'db' argument. Would be cool if you could document this, though :)

-- -- Professional Zope documentation and training
2nd edition of Web Component Development with Zope 3 is now shipping!
Zope3-dev mailing list

Reply via email to