From 531e6624b02c9da5ac652cc71743327e1f4c1f27 Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Sat, 16 Nov 2013 17:53:01 +0200 Subject: [PATCH] 7198: Date editor crashes on invalid date Trying out the approach preferred by Nick, see 7198:32708 --- gramps/gui/editors/editdate.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gramps/gui/editors/editdate.py b/gramps/gui/editors/editdate.py index f3887c8ca..1d12e6fb6 100644 --- a/gramps/gui/editors/editdate.py +++ b/gramps/gui/editors/editdate.py @@ -224,11 +224,12 @@ class EditDate(ManagedWindow): value=the_value, text=the_text, newyear=the_newyear) - except DateError: - # Switch to text only mode, leave the dialog open - # so the user sees the old data. - self.type_box.set_active(len(MOD_TEXT)-1) - continue + except DateError as e: + d = e.date # Invalid Date object! + d.set(modifier=Date.MOD_TEXTONLY, + # pray that the displayer doesn't choke here! + text=displayer.display(d)) + self.return_date = d self.close() break