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

100% coverage #12

Merged
merged 6 commits into from
Aug 24, 2018
Merged

100% coverage #12

merged 6 commits into from
Aug 24, 2018

Conversation

jamadden
Copy link
Member

Fixes #10

Currently based on #11 so that CI will run.

@jamadden jamadden requested a review from icemac August 24, 2018 13:41
@jamadden jamadden changed the title 100 coverage 100% coverage Aug 24, 2018
@jamadden
Copy link
Member Author

#11 was merged, rebased this on master.

Copy link
Member

@mgedmin mgedmin left a comment

Choose a reason for hiding this comment

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

LGTM

return bool(self.prinper or self.prinrole or self.permrole)

__nonzero__ = __bool__
Copy link
Member

Choose a reason for hiding this comment

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

TBH I think this is a Python 3 bugfix that deserves its own line in the changelog.

Copy link
Member Author

Choose a reason for hiding this comment

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

There is one:

  • Make SecurityMap and AnnotationGrantInfo have proper truth
    behaviour on Python 3; previously they were always true.

Copy link
Member

Choose a reason for hiding this comment

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

Whoops, sorry about that!

@@ -146,7 +148,7 @@ def _changed(self):
if isinstance(map, PersistentSecurityMap):
map._p_changed = 1
else:
map = PersistentSecurityMap()
map = self.map = PersistentSecurityMap()
Copy link
Member

Choose a reason for hiding this comment

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

This also looks like a bugfix that could use a changelog entry?

Copy link
Member Author

Choose a reason for hiding this comment

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

I viewed it as purely an internal performance fix, which only comes into play the first transaction this object is used in (i.e., rare). But I can add a changelog; if I do that I need to add a test that verifies this particular scenario.

Copy link
Member Author

Choose a reason for hiding this comment

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

Test and note added.

return prinrole.items()
return ()
prinrole = self.prinrole.get(principal, {})
return list(prinrole.items())
Copy link
Member

Choose a reason for hiding this comment

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

I have some worries about performance implications of these changes. Perhaps we could only invoke list() when prinrole.items() doesn't return one already, i.e. only on Python 3?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure that's really a problem because (1) The only references to either IGrantInfo (the only interface this class implements, which does not extend anything except Interface) or AnnotationGrantInfo across both zopefoundation and plone organizations are in this repository; and (2) it was completely untested before this. So I don't think it's really used.

Plus, Python 2 is going away so the number of affected users is small and getting smaller 😄

But if you feel it's important I will happily make a change.

Copy link
Member

Choose a reason for hiding this comment

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

Nah, your arguments sound very convincing.

@jamadden jamadden merged commit 4695e30 into master Aug 24, 2018
@jamadden jamadden deleted the 100coverage branch August 24, 2018 15:59
@jamadden
Copy link
Member Author

Thanks! Would you like to make a PyPI release? I don't have access.

@icemac
Copy link
Member

icemac commented Aug 27, 2018

@jamadden Thank you for tackling the issue I have created. I added you as owner of this package on PyPI.

@jamadden
Copy link
Member Author

Thanks! I've pushed 4.3.0 to PyPI.

@icemac
Copy link
Member

icemac commented Aug 27, 2018

@jamadden Thank you, too.

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