repoapi.py
changeset 9475 7863c546b135
parent 9469 032825bbacab
child 9554 d2fd866f69a2
equal deleted inserted replaced
9474:dd96b877879d 9475:7863c546b135
   132 
   132 
   133 class ClientConnection(RequestSessionBase):
   133 class ClientConnection(RequestSessionBase):
   134     """A Connection object to be used Client side.
   134     """A Connection object to be used Client side.
   135 
   135 
   136     This object is aimed to be used client side (so potential communication
   136     This object is aimed to be used client side (so potential communication
   137     with the repo through RTC) and aims to offer some compatibility with the
   137     with the repo through RPC) and aims to offer some compatibility with the
   138     cubicweb.dbapi.Connection interface.
   138     cubicweb.dbapi.Connection interface.
   139 
   139 
   140     The autoclose_session paramenter informs the connection that this session
   140     The autoclose_session parameter informs the connection that this session
   141     have been open explictly and only for this client connection. The
   141     has been opened explicitly and only for this client connection. The
   142     connection will close the session of exit.
   142     connection will close the session on exit.
   143     """
   143     """
   144     # make exceptions available through the connection object
   144     # make exceptions available through the connection object
   145     ProgrammingError = ProgrammingError
   145     ProgrammingError = ProgrammingError
   146     # attributes that may be overriden per connection instance
   146     # attributes that may be overriden per connection instance
   147     anonymous_connection = False # XXX really needed ?
   147     anonymous_connection = False # XXX really needed ?
   170         self._open = False
   170         self._open = False
   171         self._cnx.ctx_count -= 1
   171         self._cnx.ctx_count -= 1
   172         self._cnx.__exit__(exc_type, exc_val, exc_tb)
   172         self._cnx.__exit__(exc_type, exc_val, exc_tb)
   173         self._cnx = None
   173         self._cnx = None
   174         if self._autoclose_session:
   174         if self._autoclose_session:
   175             # we have to call repo.close to unsure the repo properly forget the
   175             # we have to call repo.close to ensure the repo properly forgets the
   176             # session calling session.close() is not enought :-(
   176             # session; calling session.close() is not enough :-(
   177             self._session.repo.close(self._session.id)
   177             self._session.repo.close(self._session.id)
   178 
   178 
   179 
   179 
   180     # begin silly BC
   180     # begin silly BC
   181     @property
   181     @property