parent
39a0d8c648
commit
7a82b78ff9
@ -330,9 +330,11 @@ class DBAPI(DbGeneric):
|
|||||||
"""
|
"""
|
||||||
Return the defined names that have been assigned to a default grouping.
|
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()
|
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):
|
def get_name_group_mapping(self, key):
|
||||||
"""
|
"""
|
||||||
@ -341,7 +343,8 @@ class DBAPI(DbGeneric):
|
|||||||
self.dbapi.execute(
|
self.dbapi.execute(
|
||||||
"SELECT grouping FROM name_group WHERE name = ?", [key])
|
"SELECT grouping FROM name_group WHERE name = ?", [key])
|
||||||
row = self.dbapi.fetchone()
|
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]
|
return row[0]
|
||||||
else:
|
else:
|
||||||
return key
|
return key
|
||||||
@ -566,7 +569,7 @@ class DBAPI(DbGeneric):
|
|||||||
self.dbapi.execute("SELECT grouping FROM name_group WHERE name = ?",
|
self.dbapi.execute("SELECT grouping FROM name_group WHERE name = ?",
|
||||||
[key])
|
[key])
|
||||||
row = self.dbapi.fetchone()
|
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):
|
def set_name_group_mapping(self, name, grouping):
|
||||||
"""
|
"""
|
||||||
|
@ -1758,7 +1758,7 @@ class GrampsParser(UpdateCallback):
|
|||||||
' with "%(parent)s", did not change this grouping to "%(value)s".') % {
|
' with "%(parent)s", did not change this grouping to "%(value)s".') % {
|
||||||
'key' : key, 'parent' : present, 'value' : value }
|
'key' : key, 'parent' : present, 'value' : value }
|
||||||
self.user.warn(_("Gramps ignored a name grouping"), msg)
|
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)
|
self.db.set_name_group_mapping(key, value)
|
||||||
|
|
||||||
def start_last(self, attrs):
|
def start_last(self, attrs):
|
||||||
|
Loading…
Reference in New Issue
Block a user