%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyc

�
��4]c@s�ddlmZddlmZddlmZejjd�defd��Y�Zejjd�defd	��Y�Z	ejjd�d
efd��Y�Z
dS(
i(tEXT_CONTINUEi(tevent(tutilssqlalchemy.orm.interfacestMapperExtensioncBs�eZdZed��Zed��Zed��Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�ZRS(saBase 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.

    cCs|j||d�dS(Ntinstrument_class(R(t_adapt_listener_methods(tclstselftlistener((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyt_adapt_instrument_class<scCs|j||d
�dS(Nt
init_instancetinit_failedtreconstruct_instancet
before_inserttafter_insertt
before_updatetafter_updatet
before_deletetafter_delete(	R
RRR
RRRRR(R(RRR((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyt_adapt_listener@scsZxS|D]K}tt|�}t||�}tj||�stjd||f�|dkr��fd�}tj�jd||�dtdt	�qR|dkr��fd�}tj�jd	||�dtdt	�qR|d
kr&�fd�}tj�jd||�dtdt	�qRtj�d
||dtdt	dt	�qqWdS(Ns�MapperExtension.%s is deprecated.  The MapperExtension class will be removed in a future release.  Please transition to the @event interface, using @event.listens_for(mapped_class, '%s').Rcs��fd�}|S(Ncs��|�dS(N((tinstancetctx(tls_methR(sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pytreconstructes((RR(R(RsW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pytgodstloadtrawt	propagateR
cs��fd�}|S(Ncs&���j�jj|||�dS(N(tclass_t
class_managert
original_init(Rtargstkwargs(RR(sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR
ts	((RR
(R(RsW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyRss
tinitRcs��fd�}|S(Ncs,tj���j�jj|||�dS(N(Rtwarn_exceptionRRR(RRR (RR(sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR�s	((RR(R(RsW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR�stinit_failures%stretval(
tgetattrRRtmethods_equivalenttwarn_deprecatedRtlistenRtFalsetTrue(RRRtmethodstmethtme_methRR((RsW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyRRsL




cCstS(sReceive a class when the mapper is first constructed, and has
        applied instrumentation to the mapped class.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RtmapperR((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR�scCstS(stReceive an instance when its constructor is called.

        This method is only called during a userland construction of
        an object.  It is not called when an object is loaded from the
        database.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RR.RtoldinitRRR ((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR
�scCstS(s�Receive an instance when its constructor has been called,
        and raised an exception.

        This method is only called during a userland construction of
        an object.  It is not called when an object is loaded from the
        database.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RR.RR/RRR ((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR�scCstS(s�Receive an object instance after it has been created via
        ``__new__``, and after initial attribute population has
        occurred.

        This typically occurs when the instance is created based on
        incoming result rows, and is only called once for that
        instance's lifetime.

        Note that during a result-row load, this method is called upon
        the first row received for this instance.  Note that some
        attributes and collections may or may not be loaded or even
        initialized, depending on what's present in the result rows.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RR.R((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR�scCstS(s�Receive an object instance before that instance is inserted
        into its table.

        This is a good place to set up primary key values and such
        that aren't handled otherwise.

        Column-based attributes can be modified within this method
        which will result in the new value being inserted.  However
        *no* changes to the overall flush plan can be made, and
        manipulation of the ``Session`` will not have the desired effect.
        To manipulate the ``Session`` within an extension, use
        ``SessionExtension``.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RR.t
connectionR((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR
�scCstS(s�Receive an object instance after that instance is inserted.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RR.R0R((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR�scCstS(s�Receive an object instance before that instance is updated.

        Note that this method is called for all instances that are marked as
        "dirty", even those which have no net changes to their column-based
        attributes. An object is marked as dirty when any of its column-based
        attributes have a "set attribute" operation called or when any of its
        collections are modified. If, at update time, no column-based
        attributes have any net changes, no UPDATE statement will be issued.
        This means that an instance being sent to before_update is *not* a
        guarantee that an UPDATE statement will be issued (although you can
        affect the outcome here).

        To detect if the column-based attributes on the object have net
        changes, and will therefore generate an UPDATE statement, use
        ``object_session(instance).is_modified(instance,
        include_collections=False)``.

        Column-based attributes can be modified within this method
        which will result in the new value being updated.  However
        *no* changes to the overall flush plan can be made, and
        manipulation of the ``Session`` will not have the desired effect.
        To manipulate the ``Session`` within an extension, use
        ``SessionExtension``.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RR.R0R((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyRscCstS(s�Receive an object instance after that instance is updated.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RR.R0R((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR scCstS(s�Receive an object instance before that instance is deleted.

        Note that *no* changes to the overall flush plan can be made
        here; and manipulation of the ``Session`` will not have the
        desired effect. To manipulate the ``Session`` within an
        extension, use ``SessionExtension``.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RR.R0R((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR*s
cCstS(s�Receive an object instance after that instance is deleted.

        The return value is only significant within the ``MapperExtension``
        chain; the parent mapper's behavior isn't modified by this method.

        (R(RR.R0R((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR9s(t__name__t
__module__t__doc__tclassmethodR	RRRR
RRR
RRRRR(((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR
s-V	
	
				
	 	
	tSessionExtensioncBsweZdZed��Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZRS(sBase implementation for :class:`.Session` event hooks.

    .. deprecated:: 0.7

       :class:`.SessionExtension` is deprecated and will be removed in a future
       release.  Please refer to :func:`.event.listen` in conjunction with
       the :class:`.SessionEvents` listener interface.

    Subclasses may be installed into a :class:`.Session` (or
    :class:`.sessionmaker`) using the ``extension`` keyword
    argument::

        from sqlalchemy.orm.interfaces import SessionExtension

        class MySessionExtension(SessionExtension):
            def before_commit(self, session):
                print "before commit!"

        Session = sessionmaker(extension=MySessionExtension())

    The same :class:`.SessionExtension` instance can be used
    with any number of sessions.

    c
Cs�x�ddddddddd	d
g
D]l}tt|�}t||�}tj||�s%tjd||f�tj||t||��q%q%WdS(Nt
before_committafter_committafter_rollbacktbefore_flushtafter_flushtafter_flush_postexectafter_begintafter_attachtafter_bulk_updatetafter_bulk_deletes�SessionExtension.%s is deprecated.  The SessionExtension class will be removed in a future release.  Please transition to the @event interface, using @event.listens_for(Session, '%s').(R%R5RR&R'RR((RRRR,R-R((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR`s$
cCsdS(s�Execute right before commit is called.

        Note that this may not be per-flush if a longer running
        transaction is ongoing.N((Rtsession((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR6{tcCsdS(s�Execute after a commit has occurred.

        Note that this may not be per-flush if a longer running
        transaction is ongoing.N((RR@((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR7�RAcCsdS(s�Execute after a rollback has occurred.

        Note that this may not be per-flush if a longer running
        transaction is ongoing.N((RR@((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR8�RAcCsdS(s�Execute before flush process has started.

        `instances` is an optional list of objects which were passed to
        the ``flush()`` method. N((RR@t
flush_contextt	instances((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR9�RAcCsdS(sExecute after flush has completed, but before commit has been
        called.

        Note that the session's state is still in pre-flush, i.e. 'new',
        'dirty', and 'deleted' lists still show pre-flush state as well
        as the history settings on instance attributes.N((RR@RB((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR:�RAcCsdS(scExecute after flush has completed, and after the post-exec
        state occurs.

        This will be when the 'new', 'dirty', and 'deleted' lists are in
        their final state.  An actual commit() may or may not have
        occurred, depending on whether or not the flush started its own
        transaction or participated in a larger transaction. N((RR@RB((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR;�RAcCsdS(s�Execute after a transaction is begun on a connection

        `transaction` is the SessionTransaction. This method is called
        after an engine level transaction is begun on a connection. N((RR@ttransactionR0((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR<�RAcCsdS(skExecute after an instance is attached to a session.

        This is called after an add, delete or merge. N((RR@R((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR=�RAcCsdS(sGExecute after a bulk update operation to the session.

        This is called after a session.query(...).update()

        `query` is the query object that this update operation was
        called on. `query_context` was the query context object.
        `result` is the result object returned from the bulk operation.
        N((RR@tqueryt
query_contexttresult((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR>�RAcCsdS(sGExecute after a bulk delete operation to the session.

        This is called after a session.query(...).delete()

        `query` is the query object that this delete operation was
        called on. `query_context` was the query context object.
        `result` is the result object returned from the bulk operation.
        N((RR@RERFRG((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR?�RA(R1R2R3R4RR6R7R8R9R:R;R<R=R>R?(((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR5Ds										
tAttributeExtensioncBs>eZdZeZed��Zd�Zd�Zd�Z	RS(s�Base implementation for :class:`.AttributeImpl` event hooks, events
    that fire upon attribute mutations in user code.

    .. deprecated:: 0.7

       :class:`.AttributeExtension` is deprecated and will be removed in a
       future release.  Please refer to :func:`.event.listen` in conjunction
       with the :class:`.AttributeEvents` listener interface.

    :class:`.AttributeExtension` is used to listen for set,
    remove, and append events on individual mapped attributes.
    It is established on an individual mapped attribute using
    the `extension` argument, available on
    :func:`.column_property`, :func:`.relationship`, and
    others::

        from sqlalchemy.orm.interfaces import AttributeExtension
        from sqlalchemy.orm import mapper, relationship, column_property

        class MyAttrExt(AttributeExtension):
            def append(self, state, value, initiator):
                print "append event !"
                return value

            def set(self, state, value, oldvalue, initiator):
                print "set event !"
                return value

        mapper(SomeClass, sometable, properties={
            'foo':column_property(sometable.c.foo, extension=MyAttrExt()),
            'bar':relationship(Bar, extension=MyAttrExt())
        })

    Note that the :class:`.AttributeExtension` methods
    :meth:`~.AttributeExtension.append` and
    :meth:`~.AttributeExtension.set` need to return the
    ``value`` parameter. The returned value is used as the
    effective value, and allows the extension to change what is
    ultimately persisted.

    AttributeExtension is assembled within the descriptors associated
    with a mapped class.

    c
Cs�xadddgD]P}tt|�}t||�}tj||�stjd||f�qqWtj|d|jd|jdt	dt	�tj|d|j
d|jdt	dt	�tj|d|jd|jdt	dt	�dS(Ntappendtremovetsets�AttributeExtension.%s is deprecated.  The AttributeExtension class will be removed in a future release.  Please transition to the @event interface, using @event.listens_for(Class.attribute, '%s').tactive_historyRR$(R%RHRR&R'RR(RIRLR*RJRK(RRRR,R-R((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyR�s8						cCs|S(s�Receive a collection append event.

        The returned value will be used as the actual value to be
        appended.

        ((Rtstatetvaluet	initiator((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyRI$scCsdS(sFReceive a remove event.

        No return value is defined.

        N((RRMRNRO((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyRJ-scCs|S(snReceive a set event.

        The returned value will be used as the actual value to be
        set.

        ((RRMRNtoldvalueRO((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyRK5s(
R1R2R3R*RLR4RRIRJRK(((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyRH�s-	(			N(t
interfacesRRARRtlanghelperstdependency_fortobjectRR5RH(((sW/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/deprecated_interfaces.pyt<module>s�7

Zerion Mini Shell 1.0