return localized message on parse_datetime errors
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 13 Jan 2010 15:48:07 +0100
changeset 4222 5667f493c505
parent 4211 eac4b23a42ff
child 4223 4fb00ccad3df
return localized message on parse_datetime errors
req.py
--- a/req.py	Thu Jan 07 08:02:52 2010 +0100
+++ b/req.py	Wed Jan 13 15:48:07 2010 +0100
@@ -353,7 +353,8 @@
                 date = strptime(value, format) # this returns a DateTime
                 return time(date.hour, date.minute, date.second)
             except ValueError:
-                raise ValueError('can\'t parse %r (expected %s)' % (value, format))
+                raise ValueError(self._('can\'t parse %(value)r (expected %(format)s)')
+                                 % {'value': value, 'format': format})
         try:
             format = self.property_value('ui.date-format')
             dt = strptime(value, format)
@@ -361,7 +362,8 @@
                 return todatetime(dt)
             return todate(dt)
         except ValueError:
-            raise ValueError('can\'t parse %r (expected %s)' % (value, format))
+            raise ValueError(self._('can\'t parse %(value)r (expected %(format)s)')
+                             % {'value': value, 'format': format})
 
     # abstract methods to override according to the web front-end #############