CheckboxInput.render() shouldn't catch exceptions from check_test
|Reported by:||brutasse||Owned by:||nobody|
|Cc:||marc.tamlyn@…||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
As the docs state, check_test is a callable that returns True if the checkbox should be checked for a specific value. The default implementation doesn't do anything complicated and shouldn't raise exceptions. If user-provided callables break, it django shouldn't catch the error silently.
My proposal is to simply remove that bare except and let check_test raise exceptions.
The current behaviour is actually expected and tested:
I still think it's quite a bad API and should be changed. Since that exception-swallowing behaviour isn't documented (although tested), backwards compatibility isn't that much of a concern.
Change History (5)
Changed 3 years ago by brutasse
comment:1 Changed 3 years ago by jezdez
- Needs documentation set
- Needs tests set
- Patch needs improvement set
- Triage Stage changed from Unreviewed to Accepted
comment:3 Changed 3 years ago by mjtamlyn
- Cc marc.tamlyn@… added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Accepted to Ready for checkin