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

Paul Winkler pw_lists at slinkp.com
Fri May 21 15:03:42 EDT 2004


On Thu, May 20, 2004 at 09:12:35PM +0200, Dieter Maurer wrote:
> 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...

I now believe it's implemented just fine, but it's problematic
because at least one product (Formulator) triggers a commit
when the product is loaded.

(snip)
> def startup():
>     ....
(snip)
>             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.

Understood. I spent a little time with the debugger and determined that 
this is already handled by adding the "read-only on" line to the 
<filestorage> section of zope.conf.  I confirmed this:

...
(Pdb) n
> /home/pw/Zope-2.7.0/lib/python/Zope/App/startup.py(54)startup()
-> configuration = getConfiguration()
(Pdb) n
> /home/pw/Zope-2.7.0/lib/python/Zope/App/startup.py(55)startup()
-> DB = configuration.dbtab.getDatabase('/', is_root=1)
(Pdb) myconf = configuration.dbtab.getDatabaseFactory('/').config.storage.config 
(Pdb) p myconf.read_only
True

So, apparently the storage DOES get the read-only declaration.
If I continue from this point, zope exits during installation
of Formulator, with the aforementioned ZODB.POSException.ReadOnlyError.

But if I remove everything from my Products/ , zope starts and runs
just fine... I only get ReadOnlyError if I try to modify anything,
as I would expect.

Formulator is the only culprit I'm sure of; I can trigger the
error if my Products/ contains only Formulator.
Everything else (ZSyncer, ZopeVersionControl, CMFDefault & dependencies,
some in-house stuff...) seems to be OK.
Not sure of CMFPlone because it depends on Formulator.

I have not yet found exactly how Formulator triggers a commit,
but it is definitely something called by its initialize() function.

-- 

Paul Winkler
http://www.slinkp.com



More information about the Zope-Dev mailing list