Resolve changelog conflct.

This commit is contained in:
Tres Seaver
2014-03-04 15:18:08 -05:00
3 changed files with 16 additions and 4 deletions

View File

@@ -4,11 +4,15 @@ Unreleased
Bug Fixes
~~~~~~~~~
- Time of "00:00" no longer gives ``colander.Invalid``.
- Un-break wrapping of callable instances as ``colander.deferred``.
See https://github.com/Pylons/colander/issues/141.
- Set the max length TLD to 22 in ``Email`` validator based on the
current list of valid TLDs.
See https://github.com/Pylons/colander/issues/159
- Fix an issue where ``drop`` was not recognized as a default and was
returning the ``drop`` instance instead of omitting the value.
https://github.com/Pylons/colander/issues/139

View File

@@ -1635,7 +1635,7 @@ class Time(SchemaType):
This type serializes python ``datetime.time`` objects to a
`ISO8601 <http://en.wikipedia.org/wiki/ISO_8601>`_ string format.
The format includes the date only.
The format includes the time only.
The constructor accepts no arguments.
@@ -1673,13 +1673,12 @@ class Time(SchemaType):
err_template = _('Invalid time')
def serialize(self, node, appstruct):
if not appstruct:
return null
if isinstance(appstruct, datetime.datetime):
appstruct = appstruct.time()
if not isinstance(appstruct, datetime.time):
if not appstruct:
return null
raise Invalid(node,
_('"${val}" is not a time object',
mapping={'val':appstruct})

View File

@@ -2257,6 +2257,15 @@ class TestTime(unittest.TestCase):
expected = time.isoformat().split('.')[0]
self.assertEqual(result, expected)
def test_serialize_with_zero_time(self):
import datetime
typ = self._makeOne()
time = datetime.time(0)
node = DummySchemaNode(None)
result = typ.serialize(node, time)
expected = time.isoformat().split('.')[0]
self.assertEqual(result, expected)
def test_serialize_with_datetime(self):
typ = self._makeOne()
dt = self._dt()