17 Feb
2005
17 Feb
'05
7:27 p.m.
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