File: //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyc
�
��4]c @ s� d d l m Z d d l m Z d d l m Z e j j d � d e f d � � Y� Z e j j d � d e f d � � Y� Z e j j d � d
e f d � � Y� Z
d S(
i ( t EXT_CONTINUEi ( t event( t utils sqlalchemy.orm.interfacest MapperExtensionc B s� e Z d Z e d � � Z e d � � Z e d � � Z d � Z d � Z d � Z d � Z
d � Z d � Z d
� Z
d � Z d � Z d
� Z RS( sa Base implementation for :class:`.Mapper` event hooks.
.. deprecated:: 0.7
:class:`.MapperExtension` is deprecated and will be removed in a future
release. Please refer to :func:`.event.listen` in conjunction with
the :class:`.MapperEvents` listener interface.
New extension classes subclass :class:`.MapperExtension` and are specified
using the ``extension`` mapper() argument, which is a single
:class:`.MapperExtension` or a list of such::
from sqlalchemy.orm.interfaces import MapperExtension
class MyExtension(MapperExtension):
def before_insert(self, mapper, connection, instance):
print "instance %s before insert !" % instance
m = mapper(User, users_table, extension=MyExtension())
A single mapper can maintain a chain of ``MapperExtension``
objects. When a particular mapping event occurs, the
corresponding method on each ``MapperExtension`` is invoked
serially, and each method has the ability to halt the chain
from proceeding further::
m = mapper(User, users_table, extension=[ext1, ext2, ext3])
Each ``MapperExtension`` method returns the symbol
EXT_CONTINUE by default. This symbol generally means "move
to the next ``MapperExtension`` for processing". For methods
that return objects like translated rows or new object
instances, EXT_CONTINUE means the result of the method
should be ignored. In some cases it's required for a
default mapper activity to be performed, such as adding a
new instance to a result list.
The symbol EXT_STOP has significance within a chain
of ``MapperExtension`` objects that the chain will be stopped
when this symbol is returned. Like EXT_CONTINUE, it also
has additional significance in some cases that a default
mapper activity will not be performed.
c C s | j | | d � d S( Nt instrument_class( R ( t _adapt_listener_methods( t clst selft listener( ( sW /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyt _adapt_instrument_class<