Skip to content

Conversation

@Bernie
Copy link

@Bernie Bernie commented Apr 17, 2021

This fixes the issue reported in #346

Copy link
Collaborator

@lafrech lafrech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I agree on the cause.

Would it be a better implementation if we did this?

class EmbeddedDocument:
    def required_validate(self):
        self._data.required_validate(partial=self.is_created)

class DataProxy:
    def required_validate(self, partial):
        [...]
        if partial and name not in self.get_modified_fields():
            [...]

This avoids accessing _data.get_modified_fields from upper layers.

No need to even modify each driver.

Or maybe

class EmbeddedDocument:
    def required_validate(self, update=False):
        self._data.required_validate(update=update)

class DataProxy:
    def required_validate(self, update):
        [...]
        if update and name not in self.get_modified_fields():
            [...]

Needs to specify update explicitly in the drivers but might be better.

@Bernie
Copy link
Author

Bernie commented Apr 30, 2021 via email

@Neustradamus

This comment has been minimized.

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

Successfully merging this pull request may close these issues.

3 participants