ankisync2
ankisync2 copied to clipboard
Adding deck requires common
Hi, I am trying to create a Deck. I need to do the trick with the connection (I thought it would be merged), so I won't fail on collation. The thing is that it requires common that shouldn't be NULL.
Do you happen to know what that means and how can I add this? Do you want to provide a better interface for it?
NEWDECK= "Muldeck"
def unicase_compare(x, y):
x_ = unidecode(x).lower()
y_ = unidecode(y).lower()
return 1 if x_ > y_ else -1 if x_ < y_ else 0
connection=a.db.database.connection()
connection.create_collation("unicase", unicase_compare)
try:
nd= a.db.Decks.get(a.db.Decks.name.collate("BINARY")==NEWDECK)
except:
nd = a.db.Decks.create(name=NEWDECK.encode('utf8'),common='???')