• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / AccessControl / 11016634126
82%
master: 83%

Build:
Build:
LAST BUILD BRANCH: 7.3
DEFAULT BRANCH: master
Ran 24 Sep 2024 03:10PM UTC
Jobs 1
Files 57
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

24 Sep 2024 02:51PM UTC coverage: 81.58% (+0.03%) from 81.555%
11016634126

Pull #157

github

perrinjerome
checkPermission: align behavior with objects raising in __getattr__

The observed problem was a behavior different between C and python
implementation on python 3, happening with Zope python script. When the
context can not be accessed by the current user, Zope binds a
`Shared.DC.Scripts.Bindings.UnauthorizedBinding`, a class that raises an
Unauthorized error when the context is actually accessed, in order to
postpone the Unauthorized if something is actually accessed. This class
does implements this by raising Unauthorized in __getattr__.

The python implementation of `checkPermission` uses `hasattr` and
`hasattr` has changed between python2 and python3, on python2 it was
ignoring all exceptions, including potential Unauthorized errors and
just returning False, but on python3 these errors are raised.
This change of behavior of python causes checkPermission to behave
differently: when using python implementation on python2 or when using
C implementation, such Unauthorized errors were gracefully handled and
caused checkPermission to return False, but on python3 checkPermission
raises.

This change make this scenario behave the same between python2, python3
and C implementation: Unauthorized errors raised in __getattr__ are
supported. The code is also micro-simplified by doing only one getattr
instead of hasattr and then getattr.
Pull Request #157: checkPermission: align behavior with objects raising in __getattr__

996 of 1518 branches covered (65.61%)

Branch coverage included in aggregate %.

43 of 45 new or added lines in 3 files covered. (95.56%)

5067 of 5914 relevant lines covered (85.68%)

5.14 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
93.48
0.0% src/AccessControl/tests/testPermissionRole.py
Jobs
ID Job ID Ran Files Coverage
1 11016634126.1 24 Sep 2024 03:12PM UTC 57
81.58
Source Files on build 11016634126
  • Tree
  • List 57
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Pull Request #157
  • PR Base - master (#10627980882)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc