Allow the use of 'missing=None' for Number
This commit is contained in:
@@ -1,6 +1,12 @@
|
|||||||
Changes
|
Changes
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
Next release
|
||||||
|
------------
|
||||||
|
|
||||||
|
- Allow the use of 'missing=None' for Number. See
|
||||||
|
https://github.com/Pylons/colander/pull/59 .
|
||||||
|
|
||||||
0.9.8 (2012-04-27)
|
0.9.8 (2012-04-27)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
@@ -951,7 +951,7 @@ class Number(SchemaType):
|
|||||||
num = None
|
num = None
|
||||||
|
|
||||||
def serialize(self, node, appstruct):
|
def serialize(self, node, appstruct):
|
||||||
if not appstruct:
|
if appstruct in (null, None):
|
||||||
return null
|
return null
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@@ -1192,6 +1192,13 @@ class TestInteger(unittest.TestCase):
|
|||||||
result = typ.serialize(node, val)
|
result = typ.serialize(node, val)
|
||||||
self.assertEqual(result, '1')
|
self.assertEqual(result, '1')
|
||||||
|
|
||||||
|
def test_serialize_zero(self):
|
||||||
|
val = 0
|
||||||
|
node = DummySchemaNode(None)
|
||||||
|
typ = self._makeOne()
|
||||||
|
result = typ.serialize(node, val)
|
||||||
|
self.assertEqual(result, '0')
|
||||||
|
|
||||||
class TestFloat(unittest.TestCase):
|
class TestFloat(unittest.TestCase):
|
||||||
def _makeOne(self):
|
def _makeOne(self):
|
||||||
from colander import Float
|
from colander import Float
|
||||||
|
2
setup.py
2
setup.py
@@ -32,7 +32,7 @@ testing_extras = ['nose', 'coverage']
|
|||||||
docs_extras = ['Sphinx']
|
docs_extras = ['Sphinx']
|
||||||
|
|
||||||
setup(name='colander',
|
setup(name='colander',
|
||||||
version='0.9.8',
|
version='0.9.9dev1',
|
||||||
description=('A simple schema-based serialization and deserialization '
|
description=('A simple schema-based serialization and deserialization '
|
||||||
'library'),
|
'library'),
|
||||||
long_description=README + '\n\n' + CHANGES,
|
long_description=README + '\n\n' + CHANGES,
|
||||||
|
Reference in New Issue
Block a user