From ec8c7200483136f67dcaf27190151a7e7cd08e6f Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 4 May 2011 23:27:56 +0900 Subject: [PATCH] make it possible to save with a given mod time, for use in syncing --- anki/deck.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/anki/deck.py b/anki/deck.py index 0402d7c42..cbcd02d56 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -97,9 +97,9 @@ qconf, conf, data from deck""") self.conf = simplejson.loads(self.conf) self.data = simplejson.loads(self.data) - def flush(self): + def flush(self, mod=None): "Flush state to DB, updating mod time." - self.mod = intTime() + self.mod = intTime() if mod is None else mod self.db.execute( """update deck set crt=?, mod=?, scm=?, dty=?, syncName=?, lastSync=?, @@ -109,9 +109,9 @@ qconf=?, conf=?, data=?""", simplejson.dumps(self.qconf), simplejson.dumps(self.conf), simplejson.dumps(self.data)) - def save(self, name=None): + def save(self, name=None, mod=None): "Flush, commit DB, and take out another write lock." - self.flush() + self.flush(mod=mod) self.db.commit() self.lock() self._markOp(name)