[Checkins] SVN: Zope/trunk/ 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.

Hanno Schlichting plone at hannosch.info
Fri Jan 23 14:49:23 EST 2009


Log message for revision 94966:
  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.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/App/FactoryDispatcher.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2009-01-23 18:51:41 UTC (rev 94965)
+++ Zope/trunk/doc/CHANGES.txt	2009-01-23 19:49:23 UTC (rev 94966)
@@ -9,6 +9,10 @@
 
     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
         removed in this version of Zope.
 

Modified: Zope/trunk/lib/python/App/FactoryDispatcher.py
===================================================================
--- Zope/trunk/lib/python/App/FactoryDispatcher.py	2009-01-23 18:51:41 UTC (rev 94965)
+++ Zope/trunk/lib/python/App/FactoryDispatcher.py	2009-01-23 19:49:23 UTC (rev 94966)
@@ -40,6 +40,38 @@
     
     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):
     " "
     # Allow access to factory dispatchers
@@ -49,14 +81,19 @@
         return self.__bobo_traverse__(None, name)
 
     def __bobo_traverse__(self, REQUEST, name):
-        product=self.aq_acquire('_getProducts')()._product(name)
-
         # Try to get a custom dispatcher from a Python product
         dispatcher_class=getattr(
             _product_packages().get(name, None),
             '__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)
         return dispatcher.__of__(self)
 



More information about the Checkins mailing list