Commit 9b546e39 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Add an optional parameter ignore_duplicate into registerConnectionPlugin. This...

Add an optional parameter ignore_duplicate into registerConnectionPlugin. This is useful for writing tests.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38116 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 37584032
...@@ -37,8 +37,10 @@ from Products.ERP5Type import _dtmldir ...@@ -37,8 +37,10 @@ from Products.ERP5Type import _dtmldir
connection_plugin_registry = {} connection_plugin_registry = {}
def registerConnectionPlugin(name, klass): def registerConnectionPlugin(name, klass, ignore_duplicate=False):
assert name not in connection_plugin_registry, (name, connection_plugin_registry) if not ignore_duplicate:
if name not in connection_plugin_registry:
raise ValueError('The connection plugin %r has already been registered in the registry %r' % (name, connection_plugin_registry))
connection_plugin_registry[name] = klass connection_plugin_registry[name] = klass
# Import and register known connection plugins # Import and register known connection plugins
......
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