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:
Damien Elmes 2012-07-04 19:42:24 +09:00
parent 0ac8c7ae59
commit c3aed57df5
2 changed files with 2 additions and 3 deletions

View file

@ -134,7 +134,8 @@ class DeckManager(object):
def rem(self, did, cardsToo=False, childrenToo=True):
"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
self.col._logRem([did], REM_DECK)
# do nothing else if doesn't exist

View file

@ -43,8 +43,6 @@ def test_basic():
def test_remove():
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
g1 = deck.decks.id("g1")
f = deck.newNote()