Replace uses of assert with exception-raising statements
|Reported by:||Ryan J Ollos||Owned by:|
It was noted in comment:7:ticket:11295 that we should consider replacing uses of
assert, which will be removed when running the Python interpreter in optimized (
-O) mode, with
raises. Here is an example: tags/trac-1.0.5/trac/web/session.py@:242-244#L241.
There are a few possible paths we could pursue:
- Replace all uses of
assertto protect against coding errors,
raiseexceptions for errors that can be triggered by a user in the scenario of proper-functioning code.
Whichever approach we take, it should be captured in TracDev/CodingStyle.