%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/scoping.pyo

�
��4]c
@s,ddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dgZdefd	��YZ
e
Zd
�Zx'ejD]Zee
eee��q�Wd�Zx$dD]Zee
eee��q�Wd�Zx$dD]Zee
eee��qWdS(i(tclass_mapper(texc(tSessioni(tScopedRegistry(tThreadLocalRegistry(twarntscoped_sessioncBsGeZdZdZdd�Zd�Zd�Zd�Zdd�Z	RS(stProvides scoped management of :class:`.Session` objects.

    See :ref:`unitofwork_contextual` for a tutorial.

    cCs7||_|r$t||�|_nt|�|_dS(s�Construct a new :class:`.scoped_session`.

        :param session_factory: a factory to create new :class:`.Session`
         instances. This is usually, but not necessarily, an instance
         of :class:`.sessionmaker`.
        :param scopefunc: optional function which defines
         the current scope.   If not passed, the :class:`.scoped_session`
         object assumes "thread-local" scope, and will use
         a Python ``threading.local()`` in order to maintain the current
         :class:`.Session`.  If passed, the function should return
         a hashable token; this token will be used as the key in a
         dictionary in order to store and retrieve the current
         :class:`.Session`.

        N(tsession_factoryRtregistryR(tselfRt	scopefunc((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyt__init__!s	cKs[|rM|jj�r'tjd��qW|j|�}|jj|�|Sn
|j�SdS(s�Return the current :class:`.Session`, creating it
        using the :attr:`.scoped_session.session_factory` if not present.

        :param \**kw: Keyword arguments will be passed to the
         :attr:`.scoped_session.session_factory` callable, if an existing
         :class:`.Session` is not present.  If the :class:`.Session` is present
         and keyword arguments have been passed,
         :exc:`~sqlalchemy.exc.InvalidRequestError` is raised.

        sEScoped session is already present; no new arguments may be specified.N(Rthastsa_exctInvalidRequestErrorRtset(R	tkwtsess((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyt__call__8scCs3|jj�r"|j�j�n|jj�dS(s�Dispose of the current :class:`.Session`, if present.

        This will first call :meth:`.Session.close` method
        on the current :class:`.Session`, which releases any existing
        transactional/connection resources still being held; transactions
        specifically are rolled back.  The :class:`.Session` is then
        discarded.   Upon next usage within the same scope,
        the :class:`.scoped_session` will produce a new
        :class:`.Session` object.

        N(RRtclosetclear(R	((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pytremovePs
cKs0|jj�rtd�n|jj|�dS(s�reconfigure the :class:`.sessionmaker` used by this
        :class:`.scoped_session`.

        See :meth:`.sessionmaker.configure`.

        stAt least one scoped session is already present.  configure() can not affect sessions that have already been created.N(RRRRt	configure(R	tkwargs((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyRas
cs&dtf��fd��Y}|�S(s"return a class property which produces a :class:`.Query` object
        against the class and the current :class:`.Session` when called.

        e.g.::

            Session = scoped_session(sessionmaker())

            class MyClass(object):
                query = Session.query_property()

            # after mappers are defined
            result = MyClass.query.filter(MyClass.name=='foo').all()

        Produces instances of the session's configured query class by
        default.  To override and use a custom implementation, provide
        a ``query_cls`` callable.  The callable will be invoked with
        the class's mapper as a positional argument and a session
        keyword argument.

        There is no limit to the number of query properties placed on
        a class.

        tquerycseZ��fd�ZRS(csdyHt|�}|rG�r1�|d�j��S�j�j|�SnWntjk
r_dSXdS(Ntsession(RRRtorm_exctUnmappedClassErrortNone(tstinstancetownertmapper(t	query_clsR	(sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyt__get__�s(t__name__t
__module__R"((R!R	(sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyR�s(tobject(R	R!R((R!R	sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pytquery_propertyrsN(
R#R$t__doc__RRRRRRR&(((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyRs			cs�fd�}|S(Ncst|j���||�S(N(tgetattrR(R	targsR(tname(sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pytdo�s((R*R+((R*sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyt
instrument�scs+�fd�}�fd�}t||�S(Ncst|j��|�dS(N(tsetattrR(R	tattr(R*(sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pytset_�scst|j���S(N(R(R(R	(R*(sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pytget�s(tproperty(R*R/R0((R*sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pytmakeprop�stbindtdirtytdeletedtnewtidentity_mapt	is_activet	autoflushtno_autoflushtinfot
autocommitcs�fd�}t|�S(Ncstt��||�S(N(R(R(tclsR)R(R*(sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyR+�s(tclassmethod(R*R+((R*sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pytclslevel�st	close_alltobject_sessiontidentity_keyN(
R3R4R5R6R7R8R9R:R;R<(R@RARB(tRRRRRR
tutilRRRt__all__R%Rt
ScopedSessionR,tpublic_methodstmethR-R2tpropR?(((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyt<module>s8	�		

	


Zerion Mini Shell 1.0