Pylons/colander — pull request #58 by dahlia (2012-07-12 08:15:25+00:00)
Title: Make declarative definition of a schema possible to determine child nodes’ particular order.

This patch includes two additional parameters.

The optional `pos` parameter of `SchemaNode.add()` method is useful when an added node should be placed in the particular position, in imperative way.

The optional `insert_before` parameter of `SchemaNode` constructor make child nodes possible to determine their particular order in subclassing. For example:

```python
class BaseSchema(colander.Schema):
b = colander.SchemaNode(colander.Integer())
d = colander.SchemaNode(colander.Integer())

class DeriveredSchema(BaseSchema):
e = colander.SchemaNode(colander.Integer())
c = colander.SchemaNode(colander.Integer(), insert_before='d')
a = colander.SchemaNode(colander.Integer(), insert_before='b')
f = colander.SchemaNode(colander.Integer())
```

In the above example, `DeriveredSchema` will have children in the order of `a`, `b`, `c`, `d`, `e`, `f`.

I’m not sure how suitable is this patch for the philosophy of Colander, but I think we need any way to determine order of child nodes in subclassing.

Thank you!