# HG changeset patch # User Vladimir Popescu # Date 1364897561 -7200 # Node ID 39f81e2db2fca0131f58c8de171352fb60b1f52e # Parent 26cdfc6dd6f8500974b7188b291a459e889f48d4 [dataimport] Add a ``flush`` method for all stores. For ``ObjectStore``, ``RQLObjectStore`` and ``NoHookRQLObjectStore`` the method tries to call the ``commit`` method. For ``SQLGenObjectStore``, the ``flush`` method is basically unchanged with respect to previous changesets. diff -r 26cdfc6dd6f8 -r 39f81e2db2fc dataimport.py --- a/dataimport.py Tue Apr 02 12:11:44 2013 +0200 +++ b/dataimport.py Tue Apr 02 12:12:41 2013 +0200 @@ -523,6 +523,18 @@ """ pass + def flush(self): + """The method is provided so that all stores share a common API. + It just tries to call the commit method. + """ + print 'starting flush' + try: + self.commit() + except: + print 'failed to flush' + else: + print 'flush done' + def rql(self, *args): if self._rql is not None: return self._rql(*args) @@ -1010,6 +1022,8 @@ encoding=self.dbencoding) except: print 'failed to flush' + else: + print 'flush done' finally: _entities_sql.clear() _relations_sql.clear()