repoapi.py
changeset 9125 9aaf8472bad0
parent 9116 57387c6482e5
child 9404 3e3e9b37e177
equal deleted inserted replaced
9124:d1d4b3669e41 9125:9aaf8472bad0
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """Official API to access the content of a repository
    18 """Official API to access the content of a repository
    19 """
    19 """
       
    20 
       
    21 from logilab.common.deprecation import deprecated
       
    22 
    20 from cubicweb.utils import parse_repo_uri
    23 from cubicweb.utils import parse_repo_uri
    21 from cubicweb import ConnectionError, ProgrammingError, AuthenticationError
    24 from cubicweb import ConnectionError, ProgrammingError, AuthenticationError
    22 from uuid import uuid4
    25 from uuid import uuid4
    23 from contextlib import contextmanager
    26 from contextlib import contextmanager
    24 from cubicweb.req import RequestSessionBase
    27 from cubicweb.req import RequestSessionBase
   328         # Connection yet so we use this trick to unsure the session have the
   331         # Connection yet so we use this trick to unsure the session have the
   329         # proper cnx loaded. This can be simplified one we have Standalone
   332         # proper cnx loaded. This can be simplified one we have Standalone
   330         # Connection object
   333         # Connection object
   331         return self._cnx.repo.system_source.undo_transaction(self._cnx, txuuid)
   334         return self._cnx.repo.system_source.undo_transaction(self._cnx, txuuid)
   332 
   335 
       
   336     @deprecated('[4.0] This is a repoapi.ClientConnection object not a dbapi one')
   333     def request(self):
   337     def request(self):
   334         # XXX This is DBAPI compatibility method. Deprecate it ASAP.
       
   335         return self
   338         return self
   336 
   339 
       
   340     @deprecated('[4.0] This is a repoapi.ClientConnection object not a dbapi one')
   337     def cursor(self):
   341     def cursor(self):
   338         # XXX This is DBAPI compatibility method. Deprecate it ASAP.
       
   339         return self
   342         return self
   340 
   343 
   341     @ property
   344     @ property
       
   345     @deprecated('[4.0] This is a repoapi.ClientConnection object not a dbapi one')
   342     def sessionid(self):
   346     def sessionid(self):
   343         # XXX This is DBAPI compatibility property. Deprecate it ASAP.
       
   344         return self._session.id
   347         return self._session.id
   345 
   348 
   346     @property
   349     @property
       
   350     @deprecated('[4.0] This is a repoapi.ClientConnection object not a dbapi one')
   347     def connection(self):
   351     def connection(self):
   348         # XXX This is DBAPI compatibility property. Deprecate it ASAP.
       
   349         return self
   352         return self
   350 
   353 
   351     @property
   354     @property
       
   355     @deprecated('[4.0] This is a repoapi.ClientConnection object not a dbapi one')
   352     def _repo(self):
   356     def _repo(self):
   353         # XXX This is DBAPI compatibility property. Deprecate it ASAP.
       
   354         return self._session.repo
   357         return self._session.repo