Source code for pyams_alchemy.metadirectives

#
# 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 _


[docs]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) 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)