server/sources/extlite.py
branchstable
changeset 2067 668cc93f8578
parent 2062 20f18837107c
child 2068 3d1961426bed
equal deleted inserted replaced
2066:2c4bf4ee88a2 2067:668cc93f8578
    18 class ConnectionWrapper(object):
    18 class ConnectionWrapper(object):
    19     def __init__(self, source=None):
    19     def __init__(self, source=None):
    20         self.source = source
    20         self.source = source
    21         self._cnx = None
    21         self._cnx = None
    22 
    22 
    23     def commit(self):
    23     @property
    24         if self._cnx is not None:
    24     def logged_user(self):
    25             self._cnx.commit()
    25         if self._cnx is None:
    26 
    26             self._cnx = self.source._sqlcnx
    27     def rollback(self):
    27         return self._cnx.logged_user
    28         if self._cnx is not None:
       
    29             self._cnx.rollback()
       
    30 
    28 
    31     def cursor(self):
    29     def cursor(self):
    32         if self._cnx is None:
    30         if self._cnx is None:
    33             self._cnx = self.source._sqlcnx
    31             self._cnx = self.source._sqlcnx
    34         return self._cnx.cursor()
    32         return self._cnx.cursor()
       
    33 
       
    34     def commit(self):
       
    35         if self._cnx is not None:
       
    36             self._cnx.commit()
       
    37 
       
    38     def rollback(self):
       
    39         if self._cnx is not None:
       
    40             self._cnx.rollback()
       
    41 
       
    42     def close(self):
       
    43         if self._cnx is not None:
       
    44             self._cnx.close()
       
    45             self._cnx = None
    35 
    46 
    36 
    47 
    37 class SQLiteAbstractSource(AbstractSource):
    48 class SQLiteAbstractSource(AbstractSource):
    38     """an abstract class for external sources using a sqlite database helper
    49     """an abstract class for external sources using a sqlite database helper
    39     """
    50     """