[ZCM] [ZC] 299/ 3 Comment "misuse of ZEO_CLIENT env var"

Collector: Zope Bugs and Patches ... zope-coders@zope.org
Mon, 18 Mar 2002 11:06:45 -0500


Issue #299 Update (Comment) "misuse of ZEO_CLIENT env var"
 Status Accepted, Zope/bug medium
To followup, visit:
  http://collector.zope.org/Zope/299

==============================================================
= Comment - Entry #3 by htrd on Mar 18, 2002 11:06 am

Do we want yet more environment variables?

I think the intent of the original code was correct: Products are loaded if:
1. you are non-zeo
2. you are zeo, and explicitly asked for it using FORCE_PRODUCT_LOAD
but not if:
3. you are zeo, and didnt set FORCE_PRODUCT_LOAD


What we *really* need is a method on a database object to determine whether that database has exclusive access to its contents, or whether there is some distributed access through a different database object, possibly in a different process. Lets call this method is_distributed()

Today only the ZEO storage provides this, so the database class can implement this with a crude type check. 

Zope code which previously checked ZEO_CLIENT should check root_object._p_jar._db.is_distributed()

Sound reasonable?



________________________________________
= Accept - Entry #2 by mcdonc on Mar 18, 2002 10:11 am

 Status: Pending => Accepted

 Supporters added: mcdonc

I am going to "fix" this.  I am going to add a bit to initialization that checks for a LOAD_PRODUCTS environment variable.  If it is set to a blank string or '0', product loading will not occur regardless of the ZEO_CLIENT envvar.  If it is set to false or unset and the ZEO_CLIENT envvar is set, product loading will not occur (this is the current behavior).
________________________________________
= Request - Entry #1 by htrd on Mar 18, 2002 9:24 am

The ZEO_CLIENT environment variable is used for two different things:

1. In ZEO.ClientStorage, it is used to determine whether it should use a temporary or persistent client cache. If persistent, the value of this variable determines the name of the cache. This is the documented and correct (IMHO) use of this variable.

2. In Zope, it is used to inhibit various things that shouldnt be done on every ZEO client, such as product initialization.

This means it is not possible to use Zope with a temporary Client Cache.




==============================================================