diff --git a/gramps/plugins/db/dbapi/dbapi.py b/gramps/plugins/db/dbapi/dbapi.py index 5706fae7a..b222f5a93 100644 --- a/gramps/plugins/db/dbapi/dbapi.py +++ b/gramps/plugins/db/dbapi/dbapi.py @@ -330,9 +330,11 @@ class DBAPI(DbGeneric): """ Return the defined names that have been assigned to a default grouping. """ - self.dbapi.execute("SELECT name FROM name_group ORDER BY name") + self.dbapi.execute("SELECT name, grouping FROM name_group " + "ORDER BY name") rows = self.dbapi.fetchall() - return [row[0] for row in rows] + # not None test below fixes db corrupted by 11011 for export + return [row[0] for row in rows if row[1] is not None] def get_name_group_mapping(self, key): """ @@ -341,7 +343,8 @@ class DBAPI(DbGeneric): self.dbapi.execute( "SELECT grouping FROM name_group WHERE name = ?", [key]) row = self.dbapi.fetchone() - if row: + if row and row[0] is not None: + # not None test fixes db corrupted by 11011 return row[0] else: return key @@ -566,7 +569,7 @@ class DBAPI(DbGeneric): self.dbapi.execute("SELECT grouping FROM name_group WHERE name = ?", [key]) row = self.dbapi.fetchone() - return True if row else False + return row and row[0] is not None def set_name_group_mapping(self, name, grouping): """ diff --git a/gramps/plugins/importer/importxml.py b/gramps/plugins/importer/importxml.py index fd483088c..133cb65aa 100644 --- a/gramps/plugins/importer/importxml.py +++ b/gramps/plugins/importer/importxml.py @@ -1758,7 +1758,7 @@ class GrampsParser(UpdateCallback): ' with "%(parent)s", did not change this grouping to "%(value)s".') % { 'key' : key, 'parent' : present, 'value' : value } self.user.warn(_("Gramps ignored a name grouping"), msg) - else: + elif value != 'None': # None test fixes file corrupted by 11011 self.db.set_name_group_mapping(key, value) def start_last(self, attrs):