Resolve changelog conflct.
This commit is contained in:
@@ -4,11 +4,15 @@ Unreleased
|
|||||||
Bug Fixes
|
Bug Fixes
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
|
- Time of "00:00" no longer gives ``colander.Invalid``.
|
||||||
|
|
||||||
- Un-break wrapping of callable instances as ``colander.deferred``.
|
- Un-break wrapping of callable instances as ``colander.deferred``.
|
||||||
See https://github.com/Pylons/colander/issues/141.
|
See https://github.com/Pylons/colander/issues/141.
|
||||||
|
|
||||||
- Set the max length TLD to 22 in ``Email`` validator based on the
|
- Set the max length TLD to 22 in ``Email`` validator based on the
|
||||||
current list of valid TLDs.
|
current list of valid TLDs.
|
||||||
See https://github.com/Pylons/colander/issues/159
|
See https://github.com/Pylons/colander/issues/159
|
||||||
|
|
||||||
- Fix an issue where ``drop`` was not recognized as a default and was
|
- Fix an issue where ``drop`` was not recognized as a default and was
|
||||||
returning the ``drop`` instance instead of omitting the value.
|
returning the ``drop`` instance instead of omitting the value.
|
||||||
https://github.com/Pylons/colander/issues/139
|
https://github.com/Pylons/colander/issues/139
|
||||||
|
@@ -1635,7 +1635,7 @@ class Time(SchemaType):
|
|||||||
|
|
||||||
This type serializes python ``datetime.time`` objects to a
|
This type serializes python ``datetime.time`` objects to a
|
||||||
`ISO8601 <http://en.wikipedia.org/wiki/ISO_8601>`_ string format.
|
`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.
|
The constructor accepts no arguments.
|
||||||
|
|
||||||
@@ -1673,13 +1673,12 @@ class Time(SchemaType):
|
|||||||
err_template = _('Invalid time')
|
err_template = _('Invalid time')
|
||||||
|
|
||||||
def serialize(self, node, appstruct):
|
def serialize(self, node, appstruct):
|
||||||
if not appstruct:
|
|
||||||
return null
|
|
||||||
|
|
||||||
if isinstance(appstruct, datetime.datetime):
|
if isinstance(appstruct, datetime.datetime):
|
||||||
appstruct = appstruct.time()
|
appstruct = appstruct.time()
|
||||||
|
|
||||||
if not isinstance(appstruct, datetime.time):
|
if not isinstance(appstruct, datetime.time):
|
||||||
|
if not appstruct:
|
||||||
|
return null
|
||||||
raise Invalid(node,
|
raise Invalid(node,
|
||||||
_('"${val}" is not a time object',
|
_('"${val}" is not a time object',
|
||||||
mapping={'val':appstruct})
|
mapping={'val':appstruct})
|
||||||
|
@@ -2257,6 +2257,15 @@ class TestTime(unittest.TestCase):
|
|||||||
expected = time.isoformat().split('.')[0]
|
expected = time.isoformat().split('.')[0]
|
||||||
self.assertEqual(result, expected)
|
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):
|
def test_serialize_with_datetime(self):
|
||||||
typ = self._makeOne()
|
typ = self._makeOne()
|
||||||
dt = self._dt()
|
dt = self._dt()
|
||||||
|
Reference in New Issue
Block a user