src/pyams_alchemy/metaconfigure.py
changeset 0 17f6c240cd7b
child 20 ce081139da77
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_alchemy/metaconfigure.py	Tue Mar 03 17:12:58 2015 +0100
@@ -0,0 +1,29 @@
+#
+# 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, pool_size=25, pool_recycle=-2, encoding='utf-8',
+                     convert_unicode=False, **kwargs):
+    engine = AlchemyEngineUtility(name, dsn, echo, pool_size, pool_recycle, encoding, convert_unicode, **kwargs)
+    zcml.utility(context, IAlchemyEngineUtility, engine, name=name)