[Zope-Checkins] SVN: Zope/trunk/src/ Added a corresponding set_registered_packages method and adjust ZopeTestCase
Hanno Schlichting
hannosch at hannosch.eu
Sun Jun 27 09:12:03 EDT 2010
Log message for revision 113929:
Added a corresponding set_registered_packages method and adjust ZopeTestCase
Changed:
U Zope/trunk/src/OFS/metaconfigure.py
U Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py
U Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py
-=-
Modified: Zope/trunk/src/OFS/metaconfigure.py
===================================================================
--- Zope/trunk/src/OFS/metaconfigure.py 2010-06-27 13:08:31 UTC (rev 113928)
+++ Zope/trunk/src/OFS/metaconfigure.py 2010-06-27 13:12:03 UTC (rev 113929)
@@ -77,6 +77,11 @@
return _registered_packages
+def set_registered_packages(packages):
+ global _registered_packages
+ _registered_packages = packages
+
+
def _registerPackage(module_, init_func=None):
"""Registers the given python package as a Zope 2 style product
"""
Modified: Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py 2010-06-27 13:08:31 UTC (rev 113928)
+++ Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py 2010-06-27 13:12:03 UTC (rev 113929)
@@ -191,7 +191,8 @@
def hasPackage(name):
'''Checks if a package has been registered with five:registerPackage.'''
- return name in [m.__name__ for m in getattr(Products, '_registered_packages', [])]
+ from OFS.metaconfigure import get_registered_packages
+ return name in [m.__name__ for m in get_registered_packages()]
def installPackage(name, quiet=0):
'''Installs a registered Python package.'''
Modified: Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py 2010-06-27 13:08:31 UTC (rev 113928)
+++ Zope/trunk/src/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py 2010-06-27 13:12:03 UTC (rev 113929)
@@ -18,6 +18,8 @@
import sys
from unittest import TestSuite
+from OFS.metaconfigure import get_registered_packages
+from OFS.metaconfigure import set_registered_packages
from Testing import ZopeTestCase
from Testing.ZopeTestCase import ZopeLite
@@ -96,10 +98,9 @@
cleanup.cleanUp()
sys.path[:] = self.saved
- registered = getattr(Products, '_registered_packages', None)
- if registered is not None:
- Products._registered_packages = [m for m in registered
- if m.__name__ != 'testpackage']
+ registered = get_registered_packages()
+ packages = [m for m in registered if m.__name__ != 'testpackage']
+ set_registered_packages(packages)
to_initialize = getattr(Products, '_packages_to_initialize', None)
if to_initialize is not None:
More information about the Zope-Checkins
mailing list