From 0cd6e696320e17bd5895abeb7a623a3580c5e1ee Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 19 Apr 2004 22:16:31 +0000 Subject: [PATCH] Check for validity in __repr__ and __str__ git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_datetime.i | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wxPython/src/_datetime.i b/wxPython/src/_datetime.i index da3bd3099e..197eeafe04 100644 --- a/wxPython/src/_datetime.i +++ b/wxPython/src/_datetime.i @@ -809,9 +809,15 @@ public: %pythoncode { def __repr__(self): - return '' % ( self.Format(), self.this) + if self.IsValid(): + return '' % ( self.Format(), self.this) + else: + return '' % self.this def __str__(self): - return self.Format() + if self.IsValid(): + return self.Format() + else: + return "INVALID DateTime" } }; @@ -955,7 +961,7 @@ public: %pythoncode { def __repr__(self): - return '' % ( self.Format(), self.this) + return '' % ( self.Format(), self.this) def __str__(self): return self.Format() } -- 2.50.0