deck fix print statements may be running in ascii environment

this should probably use the collection log in the future
This commit is contained in:
Damien Elmes 2018-12-24 09:54:59 +10:00
parent 8e4f5d5032
commit 1c39f4c194

View File

@ -449,13 +449,13 @@ class DeckManager:
for deck in decks: for deck in decks:
# two decks with the same name? # two decks with the same name?
if deck['name'] in names: if deck['name'] in names:
print("fix duplicate deck name", deck['name']) print("fix duplicate deck name", deck['name'].encode("utf8"))
deck['name'] += "%d" % intTime(1000) deck['name'] += "%d" % intTime(1000)
self.save(deck) self.save(deck)
# ensure no sections are blank # ensure no sections are blank
if not all(deck['name'].split("::")): if not all(deck['name'].split("::")):
print("fix deck with missing sections", deck['name']) print("fix deck with missing sections", deck['name'].encode("utf8"))
deck['name'] = "recovered%d" % intTime(1000) deck['name'] = "recovered%d" % intTime(1000)
self.save(deck) self.save(deck)
@ -463,7 +463,7 @@ class DeckManager:
if "::" in deck['name']: if "::" in deck['name']:
immediateParent = "::".join(deck['name'].split("::")[:-1]) immediateParent = "::".join(deck['name'].split("::")[:-1])
if immediateParent not in names: if immediateParent not in names:
print("fix deck with missing parent", deck['name']) print("fix deck with missing parent", deck['name'].encode("utf8"))
self._ensureParents(deck['name']) self._ensureParents(deck['name'])
names.add(immediateParent) names.add(immediateParent)