Commit bda00d22 authored by Lennart Regebro's avatar Lennart Regebro

Merge from product_installation_tracking branch. The product install now keeps...

Merge from product_installation_tracking branch. The product install now keeps a dict of installed products, and ZopeTestCase checks it, so not to install products twice.
parent 1534f218
...@@ -38,6 +38,8 @@ import Folder ...@@ -38,6 +38,8 @@ import Folder
import ZDOM import ZDOM
from FindSupport import FindSupport from FindSupport import FindSupport
# Dictionary of installed products, mainly used by ZopeTestCase.
_installedProducts = {}
class Application(Globals.ApplicationDefaultPermissions, class Application(Globals.ApplicationDefaultPermissions,
ZDOM.Root, Folder.Folder, ZDOM.Root, Folder.Folder,
...@@ -622,7 +624,13 @@ def install_products(app): ...@@ -622,7 +624,13 @@ def install_products(app):
# together and do a default initialization. # together and do a default initialization.
if done.has_key(product_name): if done.has_key(product_name):
continue continue
# We need to separately track what has been installed now, and
# what has been installed at a whole. This is because install_products
# should always install everything, but only once every time it's
# called. The _installedProducts dictionary is later used by
# ZopeTestCase to not install products twice.
done[product_name]=1 done[product_name]=1
_installedProducts[product_name]=1
install_product(app, product_dir, product_name, meta_types, install_product(app, product_dir, product_name, meta_types,
folder_permissions, raise_exc=debug_mode) folder_permissions, raise_exc=debug_mode)
......
...@@ -122,12 +122,12 @@ if not Zope2._began_startup: ...@@ -122,12 +122,12 @@ if not Zope2._began_startup:
# Allow test authors to install Zope products into the test environment. Note # Allow test authors to install Zope products into the test environment. Note
# that installProduct() must be called at module level -- never from tests. # that installProduct() must be called at module level -- never from tests.
from OFS.Application import get_folder_permissions, get_products, install_product from OFS.Application import get_folder_permissions, get_products, \
install_product, _installedProducts
from OFS.Folder import Folder from OFS.Folder import Folder
import Products import Products
_theApp = Zope2.app() _theApp = Zope2.app()
_installedProducts = {}
def hasProduct(name): def hasProduct(name):
'''Checks if a product can be found along Products.__path__''' '''Checks if a product can be found along Products.__path__'''
......
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