Add support for single-word column names (for SudoQl)
svn: r10575
This commit is contained in:
parent
02cceb2e8b
commit
20a3237420
@ -149,8 +149,9 @@ def rd(line_number, row, col, key, default = None):
|
|||||||
return default
|
return default
|
||||||
|
|
||||||
def cleanup_column_name(column):
|
def cleanup_column_name(column):
|
||||||
""" Handle column aliases """
|
""" Handle column aliases for CSV spreadsheet import and SQL """
|
||||||
retval = column
|
retval = column
|
||||||
|
# Title case:
|
||||||
if retval in ["Lastname",
|
if retval in ["Lastname",
|
||||||
"Surname", _("Surname")]:
|
"Surname", _("Surname")]:
|
||||||
return "surname"
|
return "surname"
|
||||||
@ -174,21 +175,29 @@ def cleanup_column_name(column):
|
|||||||
return "source"
|
return "source"
|
||||||
elif retval in ["Note", _("Note")]:
|
elif retval in ["Note", _("Note")]:
|
||||||
return "note"
|
return "note"
|
||||||
elif retval in ["Birthplace", "Birth place", _("Birth place")]:
|
elif retval in ["Birthplace",
|
||||||
|
"Birth place", _("Birth place")]:
|
||||||
return "birthplace"
|
return "birthplace"
|
||||||
elif retval in ["Birthdate", "Birth date", _("Birth date")]:
|
elif retval in ["Birthdate",
|
||||||
|
"Birth date", _("Birth date")]:
|
||||||
return "birthdate"
|
return "birthdate"
|
||||||
elif retval in ["Birthsource", "Birth source", _("Birth source")]:
|
elif retval in ["Birthsource",
|
||||||
|
"Birth source", _("Birth source")]:
|
||||||
return "birthsource"
|
return "birthsource"
|
||||||
elif retval in ["Deathplace", "Death place", _("Death place")]:
|
elif retval in ["Deathplace",
|
||||||
|
"Death place", _("Death place")]:
|
||||||
return "deathplace"
|
return "deathplace"
|
||||||
elif retval in ["Deathdate", "Death date", _("Death date")]:
|
elif retval in ["Deathdate",
|
||||||
|
"Death date", _("Death date")]:
|
||||||
return "deathdate"
|
return "deathdate"
|
||||||
elif retval in ["Deathsource", "Death source", _("Death source")]:
|
elif retval in ["Deathsource",
|
||||||
|
"Death source", _("Death source")]:
|
||||||
return "deathsource"
|
return "deathsource"
|
||||||
elif retval in ["Deathcause", "Death cause", _("Death cause")]:
|
elif retval in ["Deathcause",
|
||||||
|
"Death cause", _("Death cause")]:
|
||||||
return "deathcause"
|
return "deathcause"
|
||||||
elif retval in ["Grampsid", "Gramps id", _("Gramps id")]:
|
elif retval in ["Grampsid", "ID",
|
||||||
|
"Gramps id", _("Gramps id")]:
|
||||||
return "grampsid"
|
return "grampsid"
|
||||||
elif retval in ["Person", _("Person")]:
|
elif retval in ["Person", _("Person")]:
|
||||||
return "person"
|
return "person"
|
||||||
@ -215,15 +224,15 @@ def cleanup_column_name(column):
|
|||||||
elif retval in ["Place", _("Place")]:
|
elif retval in ["Place", _("Place")]:
|
||||||
return "place"
|
return "place"
|
||||||
# lowercase
|
# lowercase
|
||||||
elif retval in ["lastname",
|
elif retval in ["lastname", "last_name",
|
||||||
"surname", _("surname")]:
|
"surname", _("surname")]:
|
||||||
return "surname"
|
return "surname"
|
||||||
elif retval in ["firstname",
|
elif retval in ["firstname", "first_name", "given_name",
|
||||||
"given name", _("given name"),
|
"given name", _("given name"),
|
||||||
"given", _("given")]:
|
"given", _("given")]:
|
||||||
return "firstname"
|
return "firstname"
|
||||||
elif retval in ["callname",
|
elif retval in ["callname", "call_name",
|
||||||
"call name", _("call name"),
|
"call name",
|
||||||
"call", _("call")]:
|
"call", _("call")]:
|
||||||
return "callname"
|
return "callname"
|
||||||
elif retval in ["title", _("title")]:
|
elif retval in ["title", _("title")]:
|
||||||
@ -238,21 +247,29 @@ def cleanup_column_name(column):
|
|||||||
return "source"
|
return "source"
|
||||||
elif retval in ["note", _("note")]:
|
elif retval in ["note", _("note")]:
|
||||||
return "note"
|
return "note"
|
||||||
elif retval in ["birthplace", "birth place", _("birth place")]:
|
elif retval in ["birthplace", "birth_place",
|
||||||
|
"birth place", _("birth place")]:
|
||||||
return "birthplace"
|
return "birthplace"
|
||||||
elif retval in ["birthdate", "birth date", _("birth date")]:
|
elif retval in ["birthdate", "birth_date",
|
||||||
|
"birth date", _("birth date")]:
|
||||||
return "birthdate"
|
return "birthdate"
|
||||||
elif retval in ["birthsource", "birth source", _("birth source")]:
|
elif retval in ["birthsource", "birth_source",
|
||||||
|
"birth source", _("birth source")]:
|
||||||
return "birthsource"
|
return "birthsource"
|
||||||
elif retval in ["deathplace", "death place", _("death place")]:
|
elif retval in ["deathplace", "death_place",
|
||||||
|
"death place", _("death place")]:
|
||||||
return "deathplace"
|
return "deathplace"
|
||||||
elif retval in ["deathdate", "death date", _("death date")]:
|
elif retval in ["deathdate", "death_date",
|
||||||
|
"death date", _("death date")]:
|
||||||
return "deathdate"
|
return "deathdate"
|
||||||
elif retval in ["deathsource", "death source", _("death source")]:
|
elif retval in ["deathsource", "death_source",
|
||||||
|
"death source", _("death source")]:
|
||||||
return "deathsource"
|
return "deathsource"
|
||||||
elif retval in ["deathcause", "death cause", _("death cause")]:
|
elif retval in ["deathcause", "death_cause",
|
||||||
|
"death cause", _("death cause")]:
|
||||||
return "deathcause"
|
return "deathcause"
|
||||||
elif retval in ["grampsid", "gramps id", _("gramps id")]:
|
elif retval in ["grampsid", "id", "gramps_id",
|
||||||
|
"gramps id", _("gramps id")]:
|
||||||
return "grampsid"
|
return "grampsid"
|
||||||
elif retval in ["person", _("person")]:
|
elif retval in ["person", _("person")]:
|
||||||
return "person"
|
return "person"
|
||||||
|
Loading…
Reference in New Issue
Block a user