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

Closed
dwt opened this Issue Feb 22, 2012 · 1 comment

Projects

None yet

2 participants

@dwt

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 mcdonc added a commit that closed this issue Feb 23, 2012
@mcdonc mcdonc - ``name`` passed to a SchemaNode constructor was not respected in
  declaratively constructed schemas.  Now if you pass ``name`` to the
  SchemaNode constructor within the body of a schema class, it will take
  precedence over the name it's been assigned to in the schema class.
  See #39 .

Fixes #39.
d9f5934
@mcdonc mcdonc closed this in d9f5934 Feb 23, 2012
@mcdonc
Pylons Project member

Thank you for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment