src/pyams_alchemy/metadirectives.py
changeset 0 17f6c240cd7b
child 20 ce081139da77
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_alchemy/metadirectives.py	Tue Mar 03 17:12:58 2015 +0100
@@ -0,0 +1,60 @@
+#
+# 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
+
+# import packages
+from zope.interface import Interface
+from zope.schema import TextLine, Bool, Int, Choice
+
+from pyams_alchemy import _
+
+
+class IEngineDirective(Interface):
+    """Define a new SQLAlchemy engine"""
+
+    name = TextLine(title=_('Engine name'),
+                    description=_('Empty if this engine is the default engine.'),
+                    required=False,
+                    default='')
+
+    dsn = TextLine(title=_('Database URL'),
+                   description=_('RFC-1738 compliant URL for the database connection'),
+                   required=True)
+
+    echo = Bool(title=_('Echo SQL statements'),
+                required=False,
+                default=False)
+
+    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)
+
+    encoding = Choice(title=_('Encoding'),
+                      required=True,
+                      vocabulary='PyAMS encodings',
+                      default='utf-8')
+
+    convert_unicode = Bool(title=_('Convert Unicode'),
+                           required=True,
+                           default=False)