--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_alchemy/interfaces/__init__.py Wed Dec 05 13:09:59 2018 +0100
@@ -0,0 +1,81 @@
+#
+# 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 zope.interface import Interface
+
+# import packages
+from zope.schema import TextLine, Bool, Int, Choice
+
+from pyams_alchemy import _
+
+
+REQUEST_SESSION_KEY = 'pyams_alchemy.session'
+
+
+class IAlchemyEngineUtility(Interface):
+ """SQLALchemy engine definition interface"""
+
+ name = TextLine(title=_("Engine name"),
+ description=_("Keep empty if this engine is the default engine..."),
+ required=False,
+ default='')
+
+ dsn = TextLine(title=_('DSN'),
+ description=_('RFC-1738 compliant URL for the database connection'),
+ required=True,
+ default=u'sqlite://')
+
+ echo = Bool(title=_('Echo SQL?'),
+ description=_("Log all SQL statements to system logger"),
+ required=True,
+ default=False)
+
+ use_pool = Bool(title=_("Use connections pool?"),
+ description=_("If 'no', collections pooling will be disabled"),
+ required=True,
+ default=True)
+
+ pool_size = Int(title=_("Pool size"),
+ description=_("SQLAlchemy connections pool size"),
+ required=False,
+ default=25)
+
+ pool_recycle = Int(title=_("Pool recycle time"),
+ description=_("SQLAlchemy connection recycle time (-1 for none)"),
+ required=False,
+ default=-1)
+
+ echo_pool = Bool(title=_("Echo pool?"),
+ description=_("Log all pool checkouts/checkins to system logger?"),
+ required=True,
+ default=False)
+
+ encoding = Choice(title=_('Encoding'),
+ required=True,
+ vocabulary='PyAMS encodings',
+ default='utf-8')
+
+ convert_unicode = Bool(title=_('Convert Unicode'),
+ required=True,
+ default=False)
+
+ def get_engine(self, use_pool=True):
+ """Get SQLAlchemy engine"""
+
+ def clear_engine(self):
+ """Remove inner volatile attributes when utility properties are modified"""