Philipp von Weitershausen wrote:
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)

Ouch, what this code seems to imply is that I'd have to create new publications of all types :-S

It strikes me that I shouldn't have to mixin and create new publications of every type just because I don't want a ZODB ;-)

Is there an IApplication? If so, could whatever calls getApplication (which I guess must somehow get passed db) rather adapt db to an IApplication?

zope.conf could then return things other than ZODB db's from it's db section and everything would be great provided there was an adapter from the object returns to IApplication, where IApplication is the interface that describes whatever getApplication above should return?



PS: I'm aware the above is hand waving in some senses, I don't have the time I'd like to dig in and research this properly right now, but I want to try and get a feel of things for when I do...
Simplistix - Content Management, Zope & Python Consulting
Zope3-dev mailing list

Reply via email to