Commit 923682cb authored by Jim Fulton's avatar Jim Fulton

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.
parent 6b93005f
...@@ -37,6 +37,17 @@ Zope installation ...@@ -37,6 +37,17 @@ Zope installation
package, z2.py, and the default import directory may be found. package, z2.py, and the default import directory may be found.
FORCE_PRODUCT_LOAD
This environment variable can be used to force or suppress
Zope's normal automatic (implicit) product installation. If
this variable is set, then products are implicitly installed
is and only if the environment variable has a non-empty value.
If this environment variable is not set, then products are
implicitly installed unless the ZEO_CLIENT environment
variable is set to a non-empty value.
Profiling Profiling
PROFILE_PUBLISHER PROFILE_PUBLISHER
......
...@@ -560,8 +560,7 @@ def initializeProduct(productp, name, home, app): ...@@ -560,8 +560,7 @@ def initializeProduct(productp, name, home, app):
{'label':'Refresh', 'action':'manage_refresh', {'label':'Refresh', 'action':'manage_refresh',
'help': ('OFSP','Product_Refresh.stx')},) 'help': ('OFSP','Product_Refresh.stx')},)
if (os.environ.get('ZEO_CLIENT') and if not doInstall():
not os.environ.get('FORCE_PRODUCT_LOAD')):
get_transaction().abort() get_transaction().abort()
return product return product
...@@ -571,3 +570,10 @@ def initializeProduct(productp, name, home, app): ...@@ -571,3 +570,10 @@ def initializeProduct(productp, name, home, app):
def ihasattr(o, name): def ihasattr(o, name):
return hasattr(o, name) and o.__dict__.has_key(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')
...@@ -24,6 +24,7 @@ import stat ...@@ -24,6 +24,7 @@ import stat
from DateTime import DateTime from DateTime import DateTime
from types import ListType, TupleType from types import ListType, TupleType
from Interface.Implements import instancesOfObjectImplements from Interface.Implements import instancesOfObjectImplements
from App.Product import doInstall
import ZClasses # to enable 'PC.registerBaseClass()' import ZClasses # to enable 'PC.registerBaseClass()'
...@@ -279,6 +280,10 @@ class ProductContext: ...@@ -279,6 +280,10 @@ class ProductContext:
.jpg .png .gif -- ImageHelpTopic .jpg .png .gif -- ImageHelpTopic
.py -- APIHelpTopic .py -- APIHelpTopic
""" """
if not doInstall():
return
help=self.getProductHelp() help=self.getProductHelp()
path=os.path.join(Globals.package_home(self.__pack.__dict__), path=os.path.join(Globals.package_home(self.__pack.__dict__),
directory) directory)
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
############################################################################## ##############################################################################
__doc__='''Application support __doc__='''Application support
$Id: Application.py,v 1.187 2002/08/14 21:42:55 mj Exp $''' $Id: Application.py,v 1.188 2002/08/20 19:37:52 jim Exp $'''
__version__='$Revision: 1.187 $'[11:-2] __version__='$Revision: 1.188 $'[11:-2]
import Globals,Folder,os,sys,App.Product, App.ProductRegistry, misc_ import Globals,Folder,os,sys,App.Product, App.ProductRegistry, misc_
import time, traceback, os, Products import time, traceback, os, Products
...@@ -31,6 +31,7 @@ import ZDOM ...@@ -31,6 +31,7 @@ import ZDOM
from zLOG import LOG, ERROR, WARNING, INFO from zLOG import LOG, ERROR, WARNING, INFO
from HelpSys.HelpSys import HelpSys from HelpSys.HelpSys import HelpSys
from Acquisition import aq_base from Acquisition import aq_base
from App.Product import doInstall
class Application(Globals.ApplicationDefaultPermissions, class Application(Globals.ApplicationDefaultPermissions,
ZDOM.Root, Folder.Folder, ZDOM.Root, Folder.Folder,
...@@ -431,8 +432,7 @@ def initialize(app): ...@@ -431,8 +432,7 @@ def initialize(app):
# Note that the code from here on only runs if we are not a ZEO # Note that the code from here on only runs if we are not a ZEO
# client, or if we are a ZEO client and we've specified by way # client, or if we are a ZEO client and we've specified by way
# of env variable that we want to force products to load. # of env variable that we want to force products to load.
if (os.environ.get('ZEO_CLIENT') and if not doInstall():
not os.environ.get('FORCE_PRODUCT_LOAD')):
return return
# Check for dangling pointers (broken zclass dependencies) in the # Check for dangling pointers (broken zclass dependencies) in the
...@@ -693,10 +693,7 @@ def install_product(app, product_dir, product_name, meta_types, ...@@ -693,10 +693,7 @@ def install_product(app, product_dir, product_name, meta_types,
Folder.Folder.__dict__['__ac_permissions__']=tuple( Folder.Folder.__dict__['__ac_permissions__']=tuple(
list(Folder.Folder.__ac_permissions__)+new_permissions) list(Folder.Folder.__ac_permissions__)+new_permissions)
if (os.environ.get('ZEO_CLIENT') and if not doInstall():
not os.environ.get('FORCE_PRODUCT_LOAD')):
# we don't want to install products from clients
# (unless FORCE_PRODUCT_LOAD is defined).
get_transaction().abort() get_transaction().abort()
else: else:
get_transaction().note('Installed product '+product_name) get_transaction().note('Installed product '+product_name)
......
...@@ -31,6 +31,11 @@ def initialize(context): ...@@ -31,6 +31,11 @@ def initialize(context):
constructors=(TutorialTopic.addTutorialForm, TutorialTopic.addTutorial), constructors=(TutorialTopic.addTutorialForm, TutorialTopic.addTutorial),
) )
from App.Product import doInstall
if not doInstall():
return
# create tutorial help topics # create tutorial help topics
lesson_path=os.path.join(App.Common.package_home(globals()), 'tutorial.stx') lesson_path=os.path.join(App.Common.package_home(globals()), 'tutorial.stx')
glossary_path=os.path.join(App.Common.package_home(globals()), 'glossary.stx') glossary_path=os.path.join(App.Common.package_home(globals()), 'glossary.stx')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment