[Zope-dev] Read-only root database doesn't work ... bug or feature?

Dieter Maurer dieter at handshake.de
Thu May 20 15:12:35 EDT 2004


Paul Winkler wrote at 2004-5-19 19:15 -0400:
>
>I'm trying to figure out how to mount my main storage read-only
>with zope 2.7.0.

I fear this is not implemented...


Because, I wanted to control this behaviour through an
environment variable (and not the configuration file!),
I patched "Zope/App/startup.py":

def _isReadOnly():
    ro= os.environ.get('ZODB_READ_ONLY')
    return ro and int(ro) or 0


def startup():
    ....
    try:
        # Try to use custom storage
        m=imp.find_module('custom_zodb',[getConfiguration().instancehome])
    except:
        # if there is no custom_zodb, use the config file specified databases
        configuration = getConfiguration()
        if _isReadOnly():
            configuration.dbtab.getDatabaseFactory('/').config.storage.config.read_only = True
        

As you can see, it is the storage (and not the database),
that must get the "read-only" declaration.

-- 
Dieter



More information about the Zope-Dev mailing list