Open sosie-js opened 3 years ago
Calling deleteDecks with javascript as it is on the example with cardssToo: true still doesnt remove the deck. Im going to try to fix this issue soon since I need this fucntion to be working for my project.
I've been working on fixing the tests, for now i changed this
to say
@util.api()
def deleteDecks(self, decks, cardsToo=False):
if not cardsToo:
# since f592672fa952260655881a75a2e3c921b2e23857 (2.1.28)
# (see anki$ git log "-Gassert cardsToo")
# you can't delete decks without deleting cards as well.
# however, since 62c23c6816adf912776b9378c008a52bb50b2e8d (2.1.45)
# passing cardsToo to `rem` (long deprecated) won't raise an error!
# this is dangerous, so let's raise our own exception
if self._anki21_version >= 28:
raise Exception("Since Anki 2.1.28 it's not possible "
"to delete decks without deleting cards as well")
try:
self.startEditing()
decks = filter(lambda d: d in self.deckNames(), decks)
for deck in decks:
did = self.decks().id(deck)
self.decks().rem(did, cardsToo=cardsToo)
finally:
self.stopEditing()
Konnitchiwa,
When using Ankisync2 deleteDecks sample from the readme or from the site
result = invoke("deleteDecks", decks=decks , cardsToo=cardsToo)
it is impossible to delete any deck., it raises Exception(response["error"]) Exception: rem() takes 2 positional arguments but 3 were given
Problem is, I guess it does not match the definition of api function declared ini.py def deleteDecks(self, decks, cardsToo=False):
as cardsToo initialisation seems to interfers, maybe the same issue with 272
It crashes the ankisync2_web.py script, part of ankisync2 with ExamplesDoc Auto-Generator extension