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

Avoid write-on-read when initializing MemberAdapter #28

Merged
merged 3 commits into from Oct 18, 2017

Conversation

davisagli
Copy link
Member

This avoids writing a MemberData object to the database when MemberAdapter is being looked up for reads only. (The change is needed to avoid triggering CSRF protection errors in Plone tests.)

Copy link
Member

@tseaver tseaver left a comment

Choose a reason for hiding this comment

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

Needs additional tests / assertions in unit tests for MemberAdapter.__init__ / MemberAdapter.notifiyModified.

@davisagli
Copy link
Member Author

@tseaver tests added

Copy link
Member

@mauritsvanrees mauritsvanrees left a comment

Choose a reason for hiding this comment

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

The not defined id should be fixed. Strange that it apparently works. I wonder if the tests do not actually run that code.


@security.private
def notifyModified(self):
# Links self to parent for full persistence.
self._tool._members[id] = self._md
Copy link
Member

Choose a reason for hiding this comment

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

id is not defined here. It triggers no warnings because id is a builtin.

Copy link
Member

Choose a reason for hiding this comment

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

s/id/self._user.getId()/.

@davisagli
Copy link
Member Author

Good catch, @mauritsvanrees. That made me look at what registerMemberData does and realize that even if the broken line I added did what I intended, it would be redundant.

@mauritsvanrees mauritsvanrees merged commit f4ab23c into master Oct 18, 2017
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.

None yet

3 participants