Ñò
Ã#xPc @ s« d Z d d k Z d d k Z d d k Z d d k l Z l Z l Z d d k l Z l
Z
l Z d e i f d „ ƒ YZ
d e
f d „ ƒ YZ d e
f d
„ ƒ YZ d S( s*
Base classes for all backed-end plugins.
iÿÿÿÿN( t PublicErrort
InternalErrort CommandError( t contextt
Connectiont destroy_contextt Backendc B s e Z d Z RS( s-
Base class for all backend plugins.
( t __name__t
__module__t __doc__( ( ( s2 /usr/lib/python2.6/site-packages/ipalib/backend.pyR s t Connectiblec B s\ e Z d Z e d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z
e e
ƒ Z RS( s$
Base class for backend plugins that create connections.
In addition to the nicety of providing a standard connection API, all
backend plugins that create connections should use this base class so that
`request.destroy_context()` can properly close all open connections.
c C sJ t i | ƒ | o | i | _ n# d | i t t | ƒ ƒ f | _ d S( Ns %s_%s( R t __init__t namet idt str( t selft shared_instance( ( s2 /usr/lib/python2.6/site-packages/ipalib/backend.pyR . s
c O s… t t | i ƒ o) t d | i t i ƒ i ƒ f ƒ ‚ n | i | | Ž } t t | i t | | i
ƒ ƒ | i d | i ƒ d S( s1
Create thread-local connection.
s1 connect: 'context.%s' already exists in thread %rs Created connection context.%sN( t hasattrR R
t
StandardErrort threadingt
currentThreadt getNamet create_connectiont setattrR t
disconnectt debug( R t argst kwt conn( ( s2 /usr/lib/python2.6/site-packages/ipalib/backend.pyt connect5 s #c O s t d | i ƒ ‚ d S( Ns %s.create_connection()( t NotImplementedErrorR
( R R R ( ( s2 /usr/lib/python2.6/site-packages/ipalib/backend.pyR D s c C sn t t | i ƒ p) t d | i t i ƒ i ƒ f ƒ ‚ n | i ƒ t t | i ƒ | i d | i ƒ d S( Ns4 disconnect: 'context.%s' does not exist in thread %rs Destroyed connection context.%s(
R R R
R R R R t destroy_connectiont delattrR ( R ( ( s2 /usr/lib/python2.6/site-packages/ipalib/backend.pyR G s #
c C s t d | i ƒ ‚ d S( Ns %s.destroy_connection()( R R
( R ( ( s2 /usr/lib/python2.6/site-packages/ipalib/backend.pyR R s c C s t t | i ƒ S( sY
Return ``True`` if thread-local connection on `request.context` exists.
( R R R
( R ( ( s2 /usr/lib/python2.6/site-packages/ipalib/backend.pyt isconnectedU s c C sO t t | i ƒ p) t d | i t i ƒ i ƒ f ƒ ‚ n t t | i ƒ i S( s1
Return thread-local connection.
s no context.%s in thread %r( R R R
t AttributeErrorR R R t getattrR ( R ( ( s2 /usr/lib/python2.6/site-packages/ipalib/backend.pyt
__get_conn[ s #(
R R R t TrueR R R R R R! t _Connectible__get_connt propertyR ( ( ( s2 /usr/lib/python2.6/site-packages/ipalib/backend.pyR
% s t Executionerc B s) e Z d d d „ Z d „ Z d „ Z RS( c C s¤ | d j o | t i d