[Checkins] SVN: zope.i18n/trunk/ Bug: When parsing a date,
the parsing pattern did not ensure that the line
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Jul 10 01:57:22 EDT 2008
Log message for revision 88151:
Bug: When parsing a date, the parsing pattern did not ensure that the line
started and ended with the matching pattern, so that '1/1/2007' parsed into
'1/1/20' for example.
Changed:
U zope.i18n/trunk/CHANGES.txt
U zope.i18n/trunk/src/zope/i18n/format.py
U zope.i18n/trunk/src/zope/i18n/tests/test_formats.py
-=-
Modified: zope.i18n/trunk/CHANGES.txt
===================================================================
--- zope.i18n/trunk/CHANGES.txt 2008-07-10 02:57:35 UTC (rev 88150)
+++ zope.i18n/trunk/CHANGES.txt 2008-07-10 05:57:18 UTC (rev 88151)
@@ -2,7 +2,7 @@
CHANGES
=======
-3.5 (unreleased)
+3.5.0 (2008-07-10)
------------------
- Feature: Added new top-level negotiate function, which can be used to
@@ -29,6 +29,9 @@
(https://bugs.launchpad.net/zope3/+bug/210177), thanks to Hermann
Himmelbauer for the inital patch.
+- Bug: When parsing a date, the parsing pattern did not ensure that the line
+ started and ended with the matching pattern, so that '1/1/2007' parsed into
+ '1/1/20' for example.
3.4.0 (2007-10-02)
------------------
Modified: zope.i18n/trunk/src/zope/i18n/format.py
===================================================================
--- zope.i18n/trunk/src/zope/i18n/format.py 2008-07-10 02:57:35 UTC (rev 88150)
+++ zope.i18n/trunk/src/zope/i18n/format.py 2008-07-10 05:57:18 UTC (rev 88151)
@@ -71,10 +71,11 @@
pattern = self._pattern
# Generate the correct regular expression to parse the date and parse.
- regex = ''
+ regex = '^'
info = buildDateTimeParseInfo(self.calendar, bin_pattern)
for elem in bin_pattern:
regex += info.get(elem, elem)
+ regex += '$'
try:
results = re.match(regex, text).groups()
except AttributeError:
Modified: zope.i18n/trunk/src/zope/i18n/tests/test_formats.py
===================================================================
--- zope.i18n/trunk/src/zope/i18n/tests/test_formats.py 2008-07-10 02:57:35 UTC (rev 88150)
+++ zope.i18n/trunk/src/zope/i18n/tests/test_formats.py 2008-07-10 05:57:18 UTC (rev 88151)
@@ -346,6 +346,10 @@
def testDateTimeParseError(self):
self.assertRaises(DateTimeParseError,
self.format.parse, '02.01.03 21:48', 'dd.MM.yyyy HH:mm')
+ self.assertRaises(DateTimeParseError,
+ self.format.parse, '02.01.2003', 'dd.MM.yy')
+ self.assertRaises(DateTimeParseError,
+ self.format.parse, 'ff02.01.03', 'dd.MM.yy')
def testParse12PM(self):
self.assertEqual(
More information about the Checkins
mailing list