Skip to content

Go through field descriptors when applying constructor kwargs #6

@carljm

Description

@carljm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions