From 13049339ac4d7de4d4a636d2ce59e1ee845592b4 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 6 Apr 2012 13:34:29 +0900 Subject: [PATCH] add check for first field --- anki/importing/noteimp.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/anki/importing/noteimp.py b/anki/importing/noteimp.py index fe8c7d853..0956d90eb 100644 --- a/anki/importing/noteimp.py +++ b/anki/importing/noteimp.py @@ -70,6 +70,9 @@ class NoteImporter(Importer): flds = flds + [None] * (self.fields() - len(flds)) self.mapping = flds + def mappingOk(self): + return self.model['flds'][0]['name'] in self.mapping + def foreignNotes(self): "Return a list of foreign notes for importing." assert 0 @@ -80,6 +83,7 @@ class NoteImporter(Importer): def importNotes(self, notes): "Convert each card into a note, apply attributes and add to col." + assert self.mappingOk() # gather checks for duplicate comparison csums = {} for csum, id in self.col.db.execute(