Skip to content

Commit

Permalink
Allow the use of 'missing=None' for Number
Browse files Browse the repository at this point in the history
  • Loading branch information
dnouri committed Aug 15, 2012
1 parent 979cd65 commit 24f648d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
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)
------------------

Expand Down
2 changes: 1 addition & 1 deletion colander/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ class Number(SchemaType):
num = None

def serialize(self, node, appstruct):
if not appstruct:
if appstruct in (null, None):
return null

try:
Expand Down
7 changes: 7 additions & 0 deletions colander/tests/test_colander.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,13 @@ def test_serialize_ok(self):
result = typ.serialize(node, val)
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):
def _makeOne(self):
from colander import Float
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
docs_extras = ['Sphinx']

setup(name='colander',
version='0.9.8',
version='0.9.9dev1',
description=('A simple schema-based serialization and deserialization '
'library'),
long_description=README + '\n\n' + CHANGES,
Expand Down

0 comments on commit 24f648d

Please sign in to comment.