mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Reverting "suspend/unsuspend noweb on full sync"; obsolete
This commit is contained in:
parent
358b453906
commit
f96a7a7c5b
1 changed files with 0 additions and 16 deletions
16
anki/sync.py
16
anki/sync.py
|
@ -35,7 +35,6 @@ from anki.media import checksum
|
||||||
from anki.utils import ids2str, hexifyID
|
from anki.utils import ids2str, hexifyID
|
||||||
from anki.lang import _
|
from anki.lang import _
|
||||||
from hooks import runHook
|
from hooks import runHook
|
||||||
from anki import DeckStorage
|
|
||||||
|
|
||||||
if simplejson.__version__ < "1.7.3":
|
if simplejson.__version__ < "1.7.3":
|
||||||
raise "SimpleJSON must be 1.7.3 or later."
|
raise "SimpleJSON must be 1.7.3 or later."
|
||||||
|
@ -976,23 +975,9 @@ and cards.id in %s""" % ids2str([c[0] for c in cards])))
|
||||||
else:
|
else:
|
||||||
self.fullSyncFromServer(ret[1], ret[2])
|
self.fullSyncFromServer(ret[1], ret[2])
|
||||||
|
|
||||||
def resetNoWeb(self, path, suspend):
|
|
||||||
if suspend:
|
|
||||||
suspend = ["noweb"]
|
|
||||||
else:
|
|
||||||
suspend = []
|
|
||||||
d = DeckStorage.Deck(path, backup=False)
|
|
||||||
ids = d.findCards("tag:noweb")
|
|
||||||
if not suspend:
|
|
||||||
d.updateTagPriorities()
|
|
||||||
d.updatePriorities(ids, suspend=suspend, dirty=False)
|
|
||||||
d.s.commit()
|
|
||||||
d.close()
|
|
||||||
|
|
||||||
def fullSyncFromLocal(self, fields, path):
|
def fullSyncFromLocal(self, fields, path):
|
||||||
global sendProgressHook
|
global sendProgressHook
|
||||||
try:
|
try:
|
||||||
self.resetNoWeb(path, suspend=True)
|
|
||||||
# write into a temporary file, since POST needs content-length
|
# write into a temporary file, since POST needs content-length
|
||||||
src = open(path, "rb")
|
src = open(path, "rb")
|
||||||
(fd, name) = tempfile.mkstemp(prefix="anki")
|
(fd, name) = tempfile.mkstemp(prefix="anki")
|
||||||
|
@ -1064,7 +1049,6 @@ and cards.id in %s""" % ids2str([c[0] for c in cards])))
|
||||||
# if we were successful, overwrite old deck
|
# if we were successful, overwrite old deck
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
os.rename(tmpname, path)
|
os.rename(tmpname, path)
|
||||||
self.resetNoWeb(path, suspend=False)
|
|
||||||
finally:
|
finally:
|
||||||
runHook("fullSyncFinished")
|
runHook("fullSyncFinished")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue