[Damien Wyart]
... Is there a simple way to know from code (zpt, script, Condition of actions) that the main database has been set read-only ?
[Dieter Maurer]
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).
FWIW, both storages and connections support the isReadOnly() method; you don't have to (and shouldn't) muck around looking at private attributes like _storage or _is_read_only, and in the case of a ZEO client connection _is_read_only alone doesn't tell the full story (but isReadOnly() does).