add an option to disable the lock

This commit is contained in:
Damien Elmes 2011-03-15 07:09:40 +09:00
parent 945e5e9da8
commit a702e03df0

View file

@ -12,7 +12,7 @@ from anki.deck import _Deck
from anki.stdmodels import BasicModel
from anki.errors import AnkiError
def Deck(path, queue=True):
def Deck(path, queue=True, lock=True):
"Open a new or existing deck. Path must be unicode."
path = os.path.abspath(path)
create = not os.path.exists(path)
@ -34,7 +34,8 @@ def Deck(path, queue=True):
elif create:
deck.addModel(BasicModel(deck))
deck.save()
deck.lock()
if lock:
deck.lock()
if not queue:
return deck
# rebuild queue