From: Robin Dunn Date: Mon, 19 Apr 2004 22:16:31 +0000 (+0000) Subject: Check for validity in __repr__ and __str__ X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0cd6e696320e17bd5895abeb7a623a3580c5e1ee Check for validity in __repr__ and __str__ git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- 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() }