[Zope-Checkins] SVN: Zope/trunk/ Collector #1577: Fixed cryptic error message in ZPublisher if a non-ASCII string is passed to a date, int, long or float property.

Florent Guillaume fg at nuxeo.com
Tue Nov 16 08:11:17 EST 2004


Log message for revision 28456:
  Collector #1577: Fixed cryptic error message in ZPublisher if a non-ASCII string is passed to a date, int, long or float property.

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/ZPublisher/Converters.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2004-11-16 01:13:32 UTC (rev 28455)
+++ Zope/trunk/doc/CHANGES.txt	2004-11-16 13:11:17 UTC (rev 28456)
@@ -41,6 +41,9 @@
 
     Bugs fixed
 
+      - Collector #1577: Fixed cryptic error message in ZPublisher if a
+        non-ASCII string is passed to a date, int, long or float property.
+
       - Collector #1576: Fixed Z Search Interface to use proper HTML.
 
       - Collector #1127: strftime did not take timezone into account.

Modified: Zope/trunk/lib/python/ZPublisher/Converters.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/Converters.py	2004-11-16 01:13:32 UTC (rev 28455)
+++ Zope/trunk/lib/python/ZPublisher/Converters.py	2004-11-16 13:11:17 UTC (rev 28456)
@@ -55,7 +55,7 @@
         try: return int(v)
         except ValueError:
             raise ValueError, (
-                "An integer was expected in the value '%s'" % escape(v)
+                "An integer was expected in the value %s" % escape(`v`)
                 )
     raise ValueError, 'Empty entry when <strong>integer</strong> expected'
 
@@ -67,8 +67,8 @@
         try: return float(v)
         except ValueError:
             raise ValueError, (
-                "A floating-point number was expected in the value '%s'" %
-                escape(v)
+                "A floating-point number was expected in the value %s" %
+                escape(`v`)
                 )
     raise ValueError, (
         'Empty entry when <strong>floating-point number</strong> expected')
@@ -84,7 +84,7 @@
         try: return long(v)
         except ValueError:
             raise ValueError, (
-                "A long integer was expected in the value '%s'" % escape(v)
+                "A long integer was expected in the value %s" % escape(`v`)
                 )
     raise ValueError, 'Empty entry when <strong>integer</strong> expected'
 
@@ -105,7 +105,7 @@
     try:
         v = DateTime(v)
     except DateTime.SyntaxError, e:
-        raise DateTime.SyntaxError, escape(e)
+        raise DateTime.SyntaxError, "Invalid DateTime "+escape(`v`)
     return v
 
 def field2date_international(v):
@@ -113,7 +113,7 @@
     try:
         v = DateTime(v, datefmt="international")
     except DateTime.SyntaxError, e:
-        raise DateTime.SyntaxError, escape(e)
+        raise DateTime.SyntaxError, "Invalid DateTime "+escape(`v`)
     return v
 
 def field2boolean(v):



More information about the Zope-Checkins mailing list