Pylons / colander

A serialization/deserialization/validation library for strings, mappings and lists.
https://docs.pylonsproject.org/projects/colander/en/latest/
Other
447 stars 145 forks source link

Can't define declarative schema with non python identifiers as name #39

Closed dwt closed 12 years ago

dwt commented 12 years ago

Here's an example

        class FnordSchema(colander.Schema):
            fnord = colander.SchemaNode(
                colander.Sequence(), 
                colander.SchemaNode(colander.Integer(), name='integer in sequence'), 
                name="fnord[]"))

Instead I have to use this workaround:

        class FnordSchema(colander.Schema):
        schema = FnordSchema()
        schema.add(colander.SchemaNode(
                colander.Sequence(), 
                colander.SchemaNode(colander.Integer(), name='integer in sequence'), 
                name="fnord[]"))

Ideally the parsed value would be available under the name 'fnord' instead of 'fnord[]', but that would be an exciter. :-)

mcdonc commented 12 years ago

Thank you for the report!