swh.web.utils.urlsindex module#
- class swh.web.utils.urlsindex.UrlsIndex[source]#
Bases:
object
Simple helper class for centralizing URL patterns of a Django web application.
- add_url_pattern(url_pattern: str, view: Callable[[...], HttpResponseBase], view_name: str = '') None [source]#
Adds an URL pattern.
- Parameters:
url_pattern – string or regex describing a Django URL
view – function implementing the Django view
view_name – name of the view used to reverse the URL
- add_redirect_for_checksum_args(view_name: str, url_patterns: List[str], checksum_args: List[str]) None [source]#
Adds redirection to view with lowercase checksums when upper/mixed case checksums are passed as url arguments.
- Parameters:
view_name – name of the view to redirect requests
url_patterns – regexps describing the view URLs
checksum_args – url argument names corresponding to checksum values