mň &ÜGc@sVdklZdklZddgZdefd„ƒYZdefd„ƒYZdS((sScopedRegistry(sMapperExtensiontSessionContexttSessionContextExtcBsetZdZed„Zd„Zd„Zd„ZeeeedƒZ d„Z ee ddƒZ RS( sďA simple wrapper for ScopedRegistry that provides a "current" property which can be used to get, set, or remove the session in the current scope. By default this object provides thread-local scoping, which is the default scope provided by sqlalchemy.util.ScopedRegistry. Usage: engine = create_engine(...) def session_factory(): return Session(bind_to=engine) context = SessionContext(session_factory) s = context.current # get thread-local session context.current = Session(bind_to=other_engine) # set current session del context.current # discard the thread-local session (a new one will # be created on the next call to context.current) cCs)t||ƒ|_tt|ƒiƒdS(N(tScopedRegistrytsession_factoryt scopefunctselftregistrytsuperRt__init__(RRR((tA/home/holguin2/public_html/spyce/sqlalchemy/ext/sessioncontext.pyRscCs |iƒS(N(RR(R((R t get_currentscCs|ii|ƒdS(N(RRtsettsession(RR ((R t set_currentscCs|iiƒdS(N(RRtclear(R((R t del_current ss=Property used to get/set/del the session in the current scopecCs<y |iSWn*tj ot|ƒ|_}|SnXdS(N(Rt _extensiontAttributeErrorRtext(RR((R t_get_mapper_extension%s  tdocsEget a mapper extension that implements get_session using this context( t__name__t __module__t__doc__tNoneRR R RtpropertytcurrentRtmapper_extension(((R Rs        cBs tZdZd„Zd„ZRS(sKa mapper extionsion that provides sessions to a mapper using SessionContextcCsti|ƒ||_dS(N(tMapperExtensionRRtcontext(RR((R R2s cCs |iiS(N(RRR(R((R t get_session6s(RRRRR(((R R/s  N(tsqlalchemy.utilRtsqlalchemy.orm.mapperRt__all__tobjectRR(RR!RRR((R t?s   )