Check for validity in __repr__ and __str__

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-04-19 22:16:31 +00:00
parent 46fa338b6f
commit 0cd6e69632

View File

@@ -809,9 +809,15 @@ public:
%pythoncode {
def __repr__(self):
return '<wxDateTime: \"%s\" at %s>' % ( self.Format(), self.this)
if self.IsValid():
return '<wx.DateTime: \"%s\" at %s>' % ( self.Format(), self.this)
else:
return '<wx.DateTime: \"INVALID\" at %s>' % 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 '<wxTimeSpan: \"%s\" at %s>' % ( self.Format(), self.this)
return '<wx.TimeSpan: \"%s\" at %s>' % ( self.Format(), self.this)
def __str__(self):
return self.Format()
}