Whole file
sanic-org/sanic-routing
The author described this change as “Fix routes with different depth (#13)”. It counts as a record because the check below fails on the code as it stood at de6bbb330 and passes on 7533e2098, with nothing else changed between the two runs.
Projectsanic-org/sanic-routing
Fix saved2021-03-25
Sharing licenceMIT · LICENSE
Change size+4 −1
What the code was meant to do, written into the code itself as a save note
Fix routes with different depth (#13)
The change
| 289 | 289 | for num, line in enumerate(src): | |
| 290 | 290 | if line.indent < current: | |
| 291 | 291 | if not line.src.startswith("."): | |
| 292 | - | offset = 0 | |
| 292 | + | if offset < 0: | |
| 293 | + | offset += 1 | |
| 294 | + | else: | |
| 295 | + | offset = 0 | |
| 293 | 296 | ||
| 294 | 297 | if ( | |
| 295 | 298 | line.src.startswith("if") |
The check that tells the two apart
fail→pass·tests/test_routing.py::test_use_route_contains_children
Check file tests/test_routing.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itde6bbb330d5fe92941a74f24b116772d727c74be
Broken version dated2021-03-22
Modulesanic_routing.router
Units changedBaseRouter
Fingerprintb22bbc8d9b58c849
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.