src/pyams_alchemy/metaconfigure.py
changeset 0 17f6c240cd7b
child 20 ce081139da77
equal deleted inserted replaced
-1:000000000000 0:17f6c240cd7b
       
     1 #
       
     2 # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
       
     3 # All Rights Reserved.
       
     4 #
       
     5 # This software is subject to the provisions of the Zope Public License,
       
     6 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    10 # FOR A PARTICULAR PURPOSE.
       
    11 #
       
    12 
       
    13 __docformat__ = 'restructuredtext'
       
    14 
       
    15 
       
    16 # import standard library
       
    17 
       
    18 # import interfaces
       
    19 from pyams_alchemy.interfaces import IAlchemyEngineUtility
       
    20 
       
    21 # import packages
       
    22 from pyams_alchemy.engine import AlchemyEngineUtility
       
    23 from zope.component import zcml
       
    24 
       
    25 
       
    26 def engine_directive(context, name='', dsn='', echo=False, pool_size=25, pool_recycle=-2, encoding='utf-8',
       
    27                      convert_unicode=False, **kwargs):
       
    28     engine = AlchemyEngineUtility(name, dsn, echo, pool_size, pool_recycle, encoding, convert_unicode, **kwargs)
       
    29     zcml.utility(context, IAlchemyEngineUtility, engine, name=name)