colander icon indicating copy to clipboard operation
colander copied to clipboard

What about deferred SchemaTypes?

Open ravishi opened this issue 13 years ago • 2 comments

Hey guys. I've had this idea on my head for some time. What do you think about supporting deferred schema types?

I mean, colander atually supports them, all you have to do is inherit from colander.deferred and override __call__.

But since SchemaType.bind binds the attributes in an undefined order, something that depends on the type of the node can be binded before the type itself and break.

So I concluded that if the type was guaranteed to always be binded before anything else, It would be fine to have deferred schema types.

I think this could be useful while writing colander extensions, since sometimes is better to let the clients use the dialect colander.SchemaNode(CustomType()) than forcing them to use a custom node mylib.SchemaNode().

What do you think?

ravishi avatar Sep 13 '11 18:09 ravishi

Having an implementation would help to understand your whole idea. So if you can make a pullrequest, i ll be happy to review and merge it.

For the idea itself, i think it is just an harmless improvment and i am fine with it. @mcdonc ?

kiorky avatar Sep 21 '12 08:09 kiorky

Not sure, I guess I'd need to see some code.

mcdonc avatar Sep 21 '12 08:09 mcdonc