[Zope-Checkins] CVS: Zope/lib/python/App - Product.py:1.59 ProductContext.py:1.42

Jim Fulton jim@zope.com
Tue, 20 Aug 2002 15:38:22 -0400


Update of /cvs-repository/Zope/lib/python/App
In directory cvs.zope.org:/tmp/cvs-serv2491/lib/python/App

Modified Files:
	Product.py ProductContext.py 
Log Message:
Repaired some deficiencies in Zope's implicit installation.

- Documented FORCE_PRODUCT_LOAD

- Changed FORCE_PRODUCT_LOAD so that if it is set, it determines
  whether products are installed regardless of whether ZEO_CACHE is
  set. This means that you can disable product installation by setting
  FORCE_PRODUCT_LOAD to an empty string even if you are not using a
  ZEO persistent cache.

- Fixed the help system and Zope Tutorial product to honor
  FORCE_PRODUCT_LOAD.



=== Zope/lib/python/App/Product.py 1.58 => 1.59 ===
--- Zope/lib/python/App/Product.py:1.58	Wed Aug 14 17:31:40 2002
+++ Zope/lib/python/App/Product.py	Tue Aug 20 15:37:52 2002
@@ -560,8 +560,7 @@
             {'label':'Refresh', 'action':'manage_refresh',
              'help': ('OFSP','Product_Refresh.stx')},)
 
-    if (os.environ.get('ZEO_CLIENT') and
-        not os.environ.get('FORCE_PRODUCT_LOAD')):
+    if not doInstall():
         get_transaction().abort()
         return product
 
@@ -571,3 +570,10 @@
 
 def ihasattr(o, name):
     return hasattr(o, name) and o.__dict__.has_key(name)
+
+
+def doInstall():
+    if os.environ.has_key('FORCE_PRODUCT_LOAD'):
+        return not not os.environ['FORCE_PRODUCT_LOAD']
+
+    return not os.environ.get('ZEO_CLIENT')


=== Zope/lib/python/App/ProductContext.py 1.41 => 1.42 ===
--- Zope/lib/python/App/ProductContext.py:1.41	Wed Aug 14 17:31:40 2002
+++ Zope/lib/python/App/ProductContext.py	Tue Aug 20 15:37:52 2002
@@ -24,6 +24,7 @@
 from DateTime import DateTime
 from types import ListType, TupleType
 from Interface.Implements import instancesOfObjectImplements
+from App.Product import doInstall
 
 import ZClasses # to enable 'PC.registerBaseClass()'
 
@@ -279,6 +280,10 @@
         .jpg .png .gif   -- ImageHelpTopic
         .py              -- APIHelpTopic
         """
+
+        if not doInstall():
+            return
+        
         help=self.getProductHelp()
         path=os.path.join(Globals.package_home(self.__pack.__dict__),
                           directory)