Commit 7789a4ea authored by Rocky Burt's avatar Rocky Burt

No longer opens a zodb connection every time a ProductDispatcher is looked up.

parent e983a2a1
......@@ -8,6 +8,9 @@ Zope Changes
Bugs fixed
- No longer opens a zodb connection every time a ProductDispatcher
is looked up.
- Collector #2288: @ and + should not be quoted when forming
request URLs in BaseRequest and HTTPRequest
......
......@@ -26,31 +26,14 @@ def _product_packages():
zope2 packages and those without the Products namespace package.
"""
old_product_packages = {}
packages = {}
for x in dir(Products):
m = getattr(Products, x)
if isinstance(m, types.ModuleType):
old_product_packages[x] = m
packages = {}
app = Zope2.app()
try:
products = app.Control_Panel.Products
for product_id in products.objectIds():
product = products[product_id]
if hasattr(product, 'package_name'):
pos = product.package_name.rfind('.')
if pos > -1:
packages[product_id] = __import__(product.package_name,
globals(), {},
product.package_name[pos+1:])
else:
packages[product_id] = __import__(product.package_name)
elif old_product_packages.has_key(product_id):
packages[product_id] = old_product_packages[product_id]
finally:
app._p_jar.close()
packages[x] = m
for m in getattr(Products, '_registered_packages', []):
packages[m.__name__] = m
return packages
......
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