Parse the current request path for distro/release segments. Returns (distro, release) if the path starts with /explain/ / /..., otherwise (None, None).
()
| 51 | |
| 52 | |
| 53 | def _get_current_url_distro_release(): |
| 54 | """Parse the current request path for distro/release segments. |
| 55 | |
| 56 | Returns (distro, release) if the path starts with /explain/<distro>/<release>/..., |
| 57 | otherwise (None, None). |
| 58 | """ |
| 59 | path = request.path |
| 60 | if not path.startswith("/explain/"): |
| 61 | return None, None |
| 62 | rest = path[len("/explain/") :] |
| 63 | parts = rest.split("/") |
| 64 | if len(parts) >= 2 and _is_known_distro(parts[0]): |
| 65 | return parts[0], parts[1] |
| 66 | return None, None |
| 67 | |
| 68 | |
| 69 | @bp.app_context_processor |
no test coverage detected