Avoid application crash on invalid user input
If the user inputs an invalid date this change keeps the application from crashing when such a date is found. The invalid date information is reported to the user in the log. Fixes #12658.
This commit is contained in:
parent
bfa7c0c9f4
commit
482199d29c
@ -2873,9 +2873,17 @@ class BasePage: # pylint: disable=C1001
|
|||||||
if self.reference_sort:
|
if self.reference_sort:
|
||||||
role = ""
|
role = ""
|
||||||
elif role[1:2] == ':':
|
elif role[1:2] == ':':
|
||||||
# cal is the original calendar
|
# format of role is role_type:ISO date string
|
||||||
|
if role.count(':') > 1:
|
||||||
|
print("Invalid date :", role[2:], " for individual with ID:", gid,
|
||||||
|
". Please, use the 'verify the data' tool to correct this.")
|
||||||
|
cal, role = role.split(':', 1)
|
||||||
|
else:
|
||||||
cal, role = role.split(':')
|
cal, role = role.split(':')
|
||||||
# conver ISO date to Date for translation.
|
|
||||||
|
# cal is the original calendar
|
||||||
|
|
||||||
|
# convert ISO date to Date for translation.
|
||||||
# all modifiers are in english, so convert them
|
# all modifiers are in english, so convert them
|
||||||
# to the local language
|
# to the local language
|
||||||
if len(role.split(' - ')) > 1:
|
if len(role.split(' - ')) > 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user