/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm
Edit: /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyc (7680B)
σ
ΓΜ4]c
@ s, d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m
Z
d g Z d e f d YZ
e
Z d
Z x' e j D] Z e e
e e e q¨ Wd Z x$ d D] Z e e
e e e qΨ Wd Z x$ d D] Z e e
e e e qWd S( i ( t class_mapper( t exc( t Sessioni ( t ScopedRegistry( t ThreadLocalRegistry( t warnt scoped_sessionc B sG e Z d Z d Z d d Z d Z d Z d Z d d Z RS( st Provides scoped management of :class:`.Session` objects.
See :ref:`unitofwork_contextual` for a tutorial.
c C s7 | | _ | r$ t | | | _ n t | | _ d S( 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( t session_factoryR t registryR ( t selfR t scopefunc( ( sI /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyt __init__! s c K s[ | rM | j j r' t j d qW | j | } | j j | | Sn
| j Sd S( 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.
sE Scoped session is already present; no new arguments may be specified.N( R t hast sa_exct InvalidRequestErrorR t set( R t kwt sess( ( sI /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyt __call__8 s c C s3 | j j r" | j j n | j j d S( 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( R R t closet clear( R ( ( sI /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyt removeP s
c K s0 | j j r t d n | j j | d S( s reconfigure the :class:`.sessionmaker` used by this
:class:`.scoped_session`.
See :meth:`.sessionmaker.configure`.
st At least one scoped session is already present. configure() can not affect sessions that have already been created.N( R R R R t configure( R t kwargs( ( sI /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyR a s
c s&