(scope: Scope)
| 94 | |
| 95 | |
| 96 | def get_route_path(scope: Scope) -> str: |
| 97 | path: str = scope[class="st">"path"] |
| 98 | root_path = scope.get(class="st">"root_path", class="st">"") |
| 99 | if not root_path: |
| 100 | return path |
| 101 | |
| 102 | if not path.startswith(root_path): |
| 103 | return path |
| 104 | |
| 105 | if path == root_path: |
| 106 | return class="st">"" |
| 107 | |
| 108 | if path[len(root_path)] == class="st">"/": |
| 109 | return path[len(root_path) :] |
| 110 | |
| 111 | return path |