[Zope-Checkins] SVN: Products.Five/branches/1.5/ Added change to
registerPackage directive so that it stores the newly
Rocky Burt
rocky at serverzen.com
Mon Mar 5 08:07:28 EST 2007
Log message for revision 72986:
Added change to registerPackage directive so that it stores the newly
registered packages on the Products package object for faster reference.
This means code that looks this up (ie Zope2's FactoryDispatcher) no longer
has to open a zodb connection each time.
Changed:
U Products.Five/branches/1.5/CHANGES.txt
U Products.Five/branches/1.5/fiveconfigure.py
U Products.Five/branches/1.5/tests/test_registerpackage.py
-=-
Modified: Products.Five/branches/1.5/CHANGES.txt
===================================================================
--- Products.Five/branches/1.5/CHANGES.txt 2007-03-05 12:55:44 UTC (rev 72985)
+++ Products.Five/branches/1.5/CHANGES.txt 2007-03-05 13:07:27 UTC (rev 72986)
@@ -2,6 +2,14 @@
Five Changes
============
+Five 1.5.x (svn/unreleased)
+===========================
+
+* Added change to registerPackage directive so that it stores the newly
+ registered packages on the Products package object for faster reference.
+ This means code that looks this up (ie Zope2's FactoryDispatcher) no longer
+ has to open a zodb connection each time.
+
Five 1.5.2 (2007-01-10)
=======================
Modified: Products.Five/branches/1.5/fiveconfigure.py
===================================================================
--- Products.Five/branches/1.5/fiveconfigure.py 2007-03-05 12:55:44 UTC (rev 72985)
+++ Products.Five/branches/1.5/fiveconfigure.py 2007-03-05 13:07:27 UTC (rev 72986)
@@ -218,6 +218,11 @@
if init_func is not None:
newContext = ProductContext(product, app, module_)
init_func(newContext)
+
+ registered_packages = getattr(Products, '_registered_packages', None)
+ if registered_packages is None:
+ registered_packages = Products._registered_packages = []
+ registered_packages.append(module_)
finally:
try:
import transaction
Modified: Products.Five/branches/1.5/tests/test_registerpackage.py
===================================================================
--- Products.Five/branches/1.5/tests/test_registerpackage.py 2007-03-05 12:55:44 UTC (rev 72985)
+++ Products.Five/branches/1.5/tests/test_registerpackage.py 2007-03-05 13:07:27 UTC (rev 72986)
@@ -65,7 +65,11 @@
>>> 'pythonproduct2' in product_listing
True
+ Make sure it also shows up in ``Products._registered_packages``.
+ >>> [x.__name__ for x in getattr(Products, '_registered_packages', [])]
+ ['pythonproduct2']
+
Clean up:
>>> tearDown()
More information about the Zope-Checkins
mailing list