mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
silently ignore attempt to delete default deck
users can nest the default deck, so we don't want to throw an error when they delete a top level deck which the default deck happens to be under
This commit is contained in:
parent
0ac8c7ae59
commit
c3aed57df5
2 changed files with 2 additions and 3 deletions
|
@ -134,7 +134,8 @@ class DeckManager(object):
|
||||||
|
|
||||||
def rem(self, did, cardsToo=False, childrenToo=True):
|
def rem(self, did, cardsToo=False, childrenToo=True):
|
||||||
"Remove the deck. If cardsToo, delete any cards inside."
|
"Remove the deck. If cardsToo, delete any cards inside."
|
||||||
assert str(did) != '1'
|
if str(did) == '1':
|
||||||
|
return
|
||||||
# log the removal regardless of whether we have the deck or not
|
# log the removal regardless of whether we have the deck or not
|
||||||
self.col._logRem([did], REM_DECK)
|
self.col._logRem([did], REM_DECK)
|
||||||
# do nothing else if doesn't exist
|
# do nothing else if doesn't exist
|
||||||
|
|
|
@ -43,8 +43,6 @@ def test_basic():
|
||||||
|
|
||||||
def test_remove():
|
def test_remove():
|
||||||
deck = getEmptyDeck()
|
deck = getEmptyDeck()
|
||||||
# can't remove the default deck
|
|
||||||
assertException(AssertionError, lambda: deck.decks.rem(1))
|
|
||||||
# create a new deck, and add a note/card to it
|
# create a new deck, and add a note/card to it
|
||||||
g1 = deck.decks.id("g1")
|
g1 = deck.decks.id("g1")
|
||||||
f = deck.newNote()
|
f = deck.newNote()
|
||||||
|
|
Loading…
Reference in a new issue