Repository URL to install this package:
|
Version:
3.4.51 ▾
|
contego
/
home
/
tvault
/
.virtenv
/
lib
/
python2.7
/
site-packages
/
sqlalchemy
/
orm
/
scoping.pyc
|
|---|
ó
EYc @ s d d l m Z d d l m Z m Z m Z d d l m Z 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 qê Wd S( i ( t exc( t ScopedRegistryt ThreadLocalRegistryt warni ( t class_mapperR ( t Sessiont 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( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/scoping.pyt __init__ s c K s | r{ | j d t } | d k rk | j j rE t j d qx | j | } | j j | | Sq
| 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.
t scopesE Scoped session is already present; no new arguments may be specified.N( t popt Falset NoneR t hast sa_exct InvalidRequestErrorR t set( R t kwR t sess( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/scoping.pyt __call__5 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 ( ( sK /home/tvault/.virtenv/lib/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( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/scoping.pyR a s
c s&