From ec249b8a29a8ab79d6d427af3ee19fa3dd3032bf Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Sat, 7 May 2011 13:38:53 +0000 Subject: [PATCH] 4847: when no surname known, GRAMPS picks up the patronymic as Primary[sur] svn: r17438 --- src/gen/display/name.py | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/gen/display/name.py b/src/gen/display/name.py index 696c39718..90a9be010 100644 --- a/src/gen/display/name.py +++ b/src/gen/display/name.py @@ -148,34 +148,58 @@ def _raw_full_surname(raw_surn_data_list): def _raw_primary_surname(raw_surn_data_list): """method for the 'm' symbol: primary surname""" + nrsur = len(raw_surn_data_list) for raw_surn_data in raw_surn_data_list: if raw_surn_data[_PRIMARY_IN_LIST]: - result = "%s %s %s" % (raw_surn_data[_PREFIX_IN_LIST], - raw_surn_data[_SURNAME_IN_LIST], - raw_surn_data[_CONNECTOR_IN_LIST]) - return ' '.join(result.split()) + #if there are multiple surnames, return the primary. If there + #is only one surname, then primary has little meaning, and we + #assume a pa/matronymic should not be given as primary as it + #normally is defined independently + if nrsur == 1 and (raw_surn_data[_TYPE_IN_LIST][0] == _ORIGINPATRO + or raw_surn_data[_TYPE_IN_LIST][0] == _ORIGINMATRO): + return '' + else: + result = "%s %s %s" % (raw_surn_data[_PREFIX_IN_LIST], + raw_surn_data[_SURNAME_IN_LIST], + raw_surn_data[_CONNECTOR_IN_LIST]) + return ' '.join(result.split()) return '' def _raw_primary_surname_only(raw_surn_data_list): """method to obtain the raw primary surname data, so this returns a string """ + nrsur = len(raw_surn_data_list) for raw_surn_data in raw_surn_data_list: if raw_surn_data[_PRIMARY_IN_LIST]: - return raw_surn_data[_SURNAME_IN_LIST] + if nrsur == 1 and (raw_surn_data[_TYPE_IN_LIST][0] == _ORIGINPATRO + or raw_surn_data[_TYPE_IN_LIST][0] == _ORIGINMATRO): + return '' + else: + return raw_surn_data[_SURNAME_IN_LIST] return '' def _raw_primary_prefix_only(raw_surn_data_list): """method to obtain the raw primary surname data""" + nrsur = len(raw_surn_data_list) for raw_surn_data in raw_surn_data_list: if raw_surn_data[_PRIMARY_IN_LIST]: - return raw_surn_data[_PREFIX_IN_LIST] + if nrsur == 1 and (raw_surn_data[_TYPE_IN_LIST][0] == _ORIGINPATRO + or raw_surn_data[_TYPE_IN_LIST][0] == _ORIGINMATRO): + return '' + else: + return raw_surn_data[_PREFIX_IN_LIST] return '' def _raw_primary_conn_only(raw_surn_data_list): """method to obtain the raw primary surname data""" + nrsur = len(raw_surn_data_list) for raw_surn_data in raw_surn_data_list: if raw_surn_data[_PRIMARY_IN_LIST]: - return raw_surn_data[_CONNECTOR_IN_LIST] + if nrsur == 1 and (raw_surn_data[_TYPE_IN_LIST][0] == _ORIGINPATRO + or raw_surn_data[_TYPE_IN_LIST][0] == _ORIGINMATRO): + return '' + else: + return raw_surn_data[_CONNECTOR_IN_LIST] return '' def _raw_patro_surname(raw_surn_data_list):