- Fix bug introduced by supporting spec-mandated truncations of ISO-8601
timezones. A TypeError would be raised instead of Invalid. See https://github.com/Pylons/colander/issues/111. Ref issue #111.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
Next release
|
||||
------------
|
||||
|
||||
- Fix bug introduced by supporting spec-mandated truncations of ISO-8601
|
||||
timezones. A TypeError would be raised instead of Invalid. See
|
||||
https://github.com/Pylons/colander/issues/111.
|
||||
|
||||
1.0a4 (2013-05-21)
|
||||
------------------
|
||||
|
||||
|
@@ -129,6 +129,10 @@ def parse_date(datestring, default_timezone=UTC):
|
||||
raise ParseError("Unable to parse date string %r" % datestring)
|
||||
groups = m.groupdict()
|
||||
tz = parse_timezone(groups["timezone"], default_timezone=default_timezone)
|
||||
if (groups['year'] is None or
|
||||
groups['month'] is None or
|
||||
groups['day'] is None):
|
||||
raise ParseError('Unable to parse date string %r' % datestring)
|
||||
if groups["hour"] is None:
|
||||
groups["hour"] = 0
|
||||
if groups["minute"] is None:
|
||||
|
@@ -1954,6 +1954,12 @@ class TestDateTime(unittest.TestCase):
|
||||
e = invalid_exc(typ.deserialize, node, 'garbage')
|
||||
self.assertTrue('Invalid' in e.msg)
|
||||
|
||||
def test_deserialize_slashes_invalid(self):
|
||||
node = DummySchemaNode(None)
|
||||
typ = self._makeOne()
|
||||
e = invalid_exc(typ.deserialize, node, '2013/05/31')
|
||||
self.assertTrue('Invalid' in e.msg)
|
||||
|
||||
def test_deserialize_null(self):
|
||||
import colander
|
||||
node = DummySchemaNode(None)
|
||||
|
@@ -168,3 +168,7 @@ class Test_parse_date(unittest.TestCase):
|
||||
datetime.datetime(2007, 1, 25, 0, 0, 0, 0,
|
||||
tzinfo=UTC))
|
||||
|
||||
def test_slash_separated_raises_ParseError(self):
|
||||
from ..iso8601 import ParseError
|
||||
self.assertRaises(ParseError, self._callFUT, "2007/01/25")
|
||||
|
||||
|
Reference in New Issue
Block a user