[Zope-Checkins] SVN: Zope/branches/2.10/ Collector #2358: backported fix making 'Products' package a real "namespace package" from the trunk.

Tres Seaver tseaver at palladion.com
Tue Sep 25 11:13:02 EDT 2007


Log message for revision 80016:
  Collector #2358: backported fix making 'Products' package a real "namespace package" from the trunk.
  

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/lib/python/OFS/Application.py
  U   Zope/branches/2.10/lib/python/Products/__init__.py

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt	2007-09-25 15:05:57 UTC (rev 80015)
+++ Zope/branches/2.10/doc/CHANGES.txt	2007-09-25 15:13:02 UTC (rev 80016)
@@ -8,6 +8,9 @@
 
     Bugs fixed
 
+      - Collector #2358: backported fix making 'Products' package a real
+        "namespace package" from the trunk.
+
       - Collector #2287: form ':record' objects did not implement enough of
         the mapping interface.
 

Modified: Zope/branches/2.10/lib/python/OFS/Application.py
===================================================================
--- Zope/branches/2.10/lib/python/OFS/Application.py	2007-09-25 15:05:57 UTC (rev 80015)
+++ Zope/branches/2.10/lib/python/OFS/Application.py	2007-09-25 15:13:02 UTC (rev 80016)
@@ -634,9 +634,10 @@
                         folder_permissions, raise_exc=debug_mode)
 
     # Delayed install of packages-as-products
-    for module, init_func in Products._packages_to_initialize:
+    for module, init_func in getattr(Products, '_packages_to_initialize', []):
         install_package(app, module, init_func, raise_exc=debug_mode)
-    Products._packages_to_initialize = []
+    if hasattr(Products, '_packages_to_initialize'):
+        del Products._packages_to_initialize
 
     Products.meta_types=Products.meta_types+tuple(meta_types)
     InitializeClass(Folder.Folder)

Modified: Zope/branches/2.10/lib/python/Products/__init__.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/__init__.py	2007-09-25 15:05:57 UTC (rev 80015)
+++ Zope/branches/2.10/lib/python/Products/__init__.py	2007-09-25 15:13:02 UTC (rev 80016)
@@ -12,7 +12,9 @@
 ##############################################################################
 __ac_permissions__=()
 
-# This is used to keep track of packages which need to be initialized as
-# products. These will be processed during the usual product installation
-# in OFS.Application
-_packages_to_initialize = []
\ No newline at end of file
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)



More information about the Zope-Checkins mailing list