Commit 6c28e96c authored by Hanno Schlichting's avatar Hanno Schlichting

The persistent product registry is not required for starting Zope anymore....

The persistent product registry is not required for starting Zope anymore. `enable-product-installation` can be set to off if you don't rely on the functionality provided by the registry.
parent 134d8016
...@@ -9,6 +9,10 @@ Zope Changes ...@@ -9,6 +9,10 @@ Zope Changes
Restructuring Restructuring
- The persistent product registry is not required for starting Zope
anymore. `enable-product-installation` can be set to off if you don't
rely on the functionality provided by the registry.
- ZClasses have been deprecated for two major releases. They have been - ZClasses have been deprecated for two major releases. They have been
removed in this version of Zope. removed in this version of Zope.
......
...@@ -40,6 +40,38 @@ def _product_packages(): ...@@ -40,6 +40,38 @@ def _product_packages():
return packages return packages
class Product(object):
"""Model a non-persistent product wrapper.
"""
security = ClassSecurityInfo()
meta_type='Product'
icon='p_/Product_icon'
version=''
configurable_objects_=()
import_error_=None
thisIsAnInstalledProduct = True
title = 'This is a non-persistent product wrapper.'
def __init__(self, id):
self.id=id
security.declarePublic('Destination')
def Destination(self):
"Return the destination for factory output"
return self
def getProductHelp(self):
"""Returns the ProductHelp object associated with the Product.
"""
from HelpSys.HelpSys import ProductHelp
return ProductHelp('Help', self.id).__of__(self)
InitializeClass(Product)
class ProductDispatcher(Implicit): class ProductDispatcher(Implicit):
" " " "
# Allow access to factory dispatchers # Allow access to factory dispatchers
...@@ -49,14 +81,19 @@ class ProductDispatcher(Implicit): ...@@ -49,14 +81,19 @@ class ProductDispatcher(Implicit):
return self.__bobo_traverse__(None, name) return self.__bobo_traverse__(None, name)
def __bobo_traverse__(self, REQUEST, name): def __bobo_traverse__(self, REQUEST, name):
product=self.aq_acquire('_getProducts')()._product(name)
# Try to get a custom dispatcher from a Python product # Try to get a custom dispatcher from a Python product
dispatcher_class=getattr( dispatcher_class=getattr(
_product_packages().get(name, None), _product_packages().get(name, None),
'__FactoryDispatcher__', '__FactoryDispatcher__',
FactoryDispatcher) FactoryDispatcher)
productfolder = self.aq_acquire('_getProducts')()
try:
product = productfolder._product(name)
except AttributeError:
# If we do not have a persistent product entry, return
product = Product(name)
dispatcher=dispatcher_class(product, self.aq_parent, REQUEST) dispatcher=dispatcher_class(product, self.aq_parent, REQUEST)
return dispatcher.__of__(self) return dispatcher.__of__(self)
......
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