Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go through field descriptors when applying constructor kwargs #6

Open
carljm opened this issue Jan 20, 2011 · 0 comments
Open

Go through field descriptors when applying constructor kwargs #6

carljm opened this issue Jan 20, 2011 · 0 comments

Comments

@carljm
Copy link
Contributor

carljm commented Jan 20, 2011

Currently DataObject.init does "self.dict.update(**kwargs)". In my application I've got some specialized Field types that want to do some particular handling via set when data is assigned to them, but init's direct assignment to self.dict bypasses the Field descriptor.

Is there any reason why the dict update couldn't be replaced by "for k, v in kwargs.iteritems(): setattr(self, k, v)" so it would go through Fields? I've done this as a subclass override for my application and it seems to work fine. I can move it upstream and put together a pull request if a maintainer comments here that the idea is acceptable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant