Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

SchemaNode constructor doesn't accept typ as a keyword argument #90

Closed
danwerner opened this Issue · 3 comments

2 participants

@danwerner

Constructing SchemaNodes as follows:

colander.SchemaNode(typ=colander.Integer)

Leads to a "NotImplementedError: SchemaNode construction without a typ argument ...". Ideally, the SchemaNode constructor would have code somewhat like this:

if arg:
    self.typ = arg[0]
    _add_node_children(self, arg[1:])
elif 'typ' in kw:
    self.typ = kw['typ']
else:
    self.typ = self.schema_type()

That would allow constructing SchemaNodes from dictionaries of arbitrary keyword arguments.

@jayd3e
Collaborator

My only critique would be that instead of using 'typ' as the keyword, we should use 'type_'. As it is more clear.

@danwerner

Just noticed: In my example, instead of kw['typ'], it should probably be kw.pop('typ').

@jayd3e
Collaborator

Good catch, will change that.

@mcdonc mcdonc closed this in 2909ea8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.