cubicweb/server/sqlutils.py
changeset 12508 a8c1ea390400
parent 12285 512536a40993
child 12567 26744ad37953
equal deleted inserted replaced
12507:211472ab15c8 12508:a8c1ea390400
    32 
    32 
    33 from pytz import utc
    33 from pytz import utc
    34 
    34 
    35 from logilab import database as db, common as lgc
    35 from logilab import database as db, common as lgc
    36 from logilab.common.shellutils import ProgressBar, DummyProgressBar
    36 from logilab.common.shellutils import ProgressBar, DummyProgressBar
    37 from logilab.common.deprecation import deprecated
       
    38 from logilab.common.logging_ext import set_log_methods
    37 from logilab.common.logging_ext import set_log_methods
    39 from logilab.common.date import utctime, utcdatetime, strptime
    38 from logilab.common.date import utctime, utcdatetime, strptime
    40 from logilab.database.sqlgen import SQLGenerator
    39 from logilab.database.sqlgen import SQLGenerator
    41 
    40 
    42 from cubicweb import Binary, ConfigurationError
    41 from cubicweb import Binary, ConfigurationError
   234         except Exception:
   233         except Exception:
   235             pass
   234             pass
   236         self._source.info('trying to reconnect')
   235         self._source.info('trying to reconnect')
   237         self.cnx = self._source.get_connection()
   236         self.cnx = self._source.get_connection()
   238         self.cu = self.cnx.cursor()
   237         self.cu = self.cnx.cursor()
   239 
       
   240     @deprecated('[3.19] use .cu instead')
       
   241     def __getitem__(self, uri):
       
   242         assert uri == 'system'
       
   243         return self.cu
       
   244 
       
   245     @deprecated('[3.19] use repo.system_source instead')
       
   246     def source(self, uid):
       
   247         assert uid == 'system'
       
   248         return self._source
       
   249 
       
   250     @deprecated('[3.19] use .cnx instead')
       
   251     def connection(self, uid):
       
   252         assert uid == 'system'
       
   253         return self.cnx
       
   254 
   238 
   255 
   239 
   256 class SqliteConnectionWrapper(ConnectionWrapper):
   240 class SqliteConnectionWrapper(ConnectionWrapper):
   257     """Sqlite specific connection wrapper: close the connection each time it's
   241     """Sqlite specific connection wrapper: close the connection each time it's
   258     freed (and reopen it later when needed)
   242     freed (and reopen it later when needed)