src/pyams_alchemy/metaconfigure.py
changeset 63 40f12a3d67db
child 77 2be615fc6da4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_alchemy/metaconfigure.py	Wed Dec 05 13:09:59 2018 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_alchemy.interfaces import IAlchemyEngineUtility
+
+# import packages
+from pyams_alchemy.engine import AlchemyEngineUtility
+from zope.component import zcml
+
+
+def engine_directive(context, name='', dsn='', echo=False, use_pool=True, pool_size=25, pool_recycle=-2,
+                     echo_pool=False, encoding='utf-8', convert_unicode=False, **kwargs):
+    engine = AlchemyEngineUtility(name, dsn, echo, use_pool, pool_size, pool_recycle, echo_pool, encoding,
+                                  convert_unicode, **kwargs)
+    zcml.utility(context, IAlchemyEngineUtility, engine, name=name)