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

zopefoundation / AccessControl / 11251428026
82%
master: 82%

Build:
Build:
LAST BUILD BRANCH: config-with-c-code-template-3c1c588c
DEFAULT BRANCH: master
Ran 09 Oct 2024 08:48AM 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

09 Oct 2024 08:45AM UTC coverage: 81.671% (+0.1%) from 81.555%
11251428026

Pull #157

github

perrinjerome
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 `rolesForPermissionOn` used `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 now raised.
This change of behavior of python causes `rolesForPermissionOn` 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 the
Unauthorized is raised.

The C implementation of `rolesForPermissionOn` uses a construct
equivalent to the python2 version of `hasattr`. For consistency - and
because ignoring errors is usually not good - we also want to change it
to be have like the python3 implementation.

This change make this scenario behave the same between python and C
implementations:
 - `Unauthorized` errors raised in `__getattr__` are supported on py3.
 - Other errors  than `AttributeError` and `Unauthorized` raised in
    `__getattr__` are no longer ignored in the C implementation.
Pull Request #157: Align behavior with objects raising in `__getattr__`

1005 of 1527 branches covered (65.82%)

Branch coverage included in aggregate %.

71 of 73 new or added lines in 3 files covered. (97.26%)

5095 of 5942 relevant lines covered (85.75%)

5.14 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
95.35
1.87% src/AccessControl/tests/testPermissionRole.py
Jobs
ID Job ID Ran Files Coverage
1 11251428026.1 09 Oct 2024 08:50AM UTC 57
81.67
Source Files on build 11251428026
  • Tree
  • List 57
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Pull Request #157
  • PR Base - master (#11104225497)
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

© 2025 Coveralls, Inc