[Zope] Knowing the Zope database is configured read-only

Dieter Maurer dieter at handshake.de
Thu Feb 17 14:27:44 EST 2005


Damien Wyart wrote at 2005-2-17 17:35 +0100:
> ...
>Is there a simple way to know from code (zpt, script, Condition of
>actions) that the main database has been set read-only ?

I do not know of a simple way -- but a complex one:

  If "obj" is a persistent object, then "obj._p_jar" is
  its ZODB connection (that loaded it from the ZODB).

  If "conn" is a ZODB connection, then "conn._storage" is
  its ZODB storage.

  If "storage" is a storage, then, usually, you
  can check the "_is_read_only" attribute to determine
  writability.

As you see from the "_" prefix in attribute, this
method requires trusted code (e.g. an External Method).

-- 
Dieter


More information about the Zope mailing list