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.

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

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

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to