Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
danwerner opened this Issue · 3 comments

2 participants

Daniel Werner Joe Dallago
Daniel Werner

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.

Joe Dallago
Collaborator

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

Daniel Werner

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

Joe Dallago
Collaborator

Good catch, will change that.

Chris McDonough 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.