Merge branch 'fix_issue_179' of https://github.com/rcommande/colander into rcommande-fix_issue_179

Conflicts:
	CHANGES.rst
	CONTRIBUTORS.txt
This commit is contained in:
Tres Seaver
2015-02-04 10:52:36 -05:00
4 changed files with 19 additions and 1 deletions

View File

@@ -21,6 +21,13 @@ Features
- Add a ``missing_msg`` argument to ``SchemaNode`` that specifies the error
message to be used when the node is required and missing
Bug Fixes
---------
- Fix an issue where the ``flatten()`` method produces an invalid name
(ex: "answer.0.") for the type "Sequence". See
https://github.com/Pylons/colander/issues/179
1.0 (2014-11-26)
----------------

View File

@@ -121,6 +121,7 @@ Contributors
- Cédric Messiant, 2014/06/27
- Gouji Ochiai, 2014/08/21
- Tim Tisdall, 2014/09/10
- Romain Commandé, 2014/10/11
- Nando Florestan, 2014/11/27
- Amos Latteier, 2014/11/30
- Jimmy Thrasibule, 2014/12/11

View File

@@ -506,7 +506,7 @@ class SchemaType(object):
selfname = prefix
else:
selfname = '%s%s' % (prefix, node.name)
result[selfname] = appstruct
result[selfname.rstrip('.')] = appstruct
return result
def unflatten(self, node, paths, fstruct):

View File

@@ -1375,6 +1375,16 @@ class TestSequence(unittest.TestCase):
result = typ.flatten(node, [1, 2])
self.assertEqual(result, {'node.0': 1, 'node.1': 2})
def test_flatten_with_integer(self):
from colander import Integer
node = DummySchemaNode(None, name='node')
node.children = [
DummySchemaNode(Integer(), name='foo'),
]
typ = self._makeOne()
result = typ.flatten(node, [1, 2])
self.assertEqual(result, {'node.0': 1, 'node.1': 2})
def test_flatten_listitem(self):
node = DummySchemaNode(None, name='node')
node.children = [