]> git.saurik.com Git - wxWidgets.git/commitdiff
Ensure that the results of __str__ and __repr__ are strings
authorRobin Dunn <robin@alldunn.com>
Sat, 9 Apr 2005 20:07:25 +0000 (20:07 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 9 Apr 2005 20:07:25 +0000 (20:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/_datetime.i

index 4bba1d2124c447e3a3d8a82beec2960906cc7527..f0284ce688763161d28a33be8f8e9f3d146bba06 100644 (file)
@@ -860,12 +860,13 @@ public:
     %pythoncode {
     def __repr__(self):
         if self.IsValid():
-            return '<wx.DateTime: \"%s\" at %s>' % ( self.Format(), self.this)
+            f = self.Format().encode(wx.GetDefaultPyEncoding())
+            return '<wx.DateTime: \"%s\" at %s>' % ( f, self.this)
         else:
             return '<wx.DateTime: \"INVALID\" at %s>' % self.this
     def __str__(self):
         if self.IsValid():
-            return self.Format()
+            return self.Format().encode(wx.GetDefaultPyEncoding())
         else:
             return "INVALID DateTime"
     }
@@ -1011,9 +1012,10 @@ public:
 
     %pythoncode {
      def __repr__(self):
-         return '<wx.TimeSpan: \"%s\" at %s>' % ( self.Format(), self.this)
+         f = self.Format().encode(wx.GetDefaultPyEncoding())
+         return '<wx.TimeSpan: \"%s\" at %s>' % ( f, self.this)
      def __str__(self):
-         return self.Format()
+         return self.Format().encode(wx.GetDefaultPyEncoding())
      }
 };