reviewboard.site.middleware¶
Middleware for Local Sites.
- class LocalSiteMiddleware(get_response)[source]¶
Bases:
object
Middleware that handles storing information on the Local Site in use.
This adds a new
local_site
attribute to theHttpRequest
that, when first accessed, will fetch and cache the matchingLocalSite
. If there’s no Local Site for this given request, this will storeNone
instead.- __init__(get_response)[source]¶
Initialize the middleware.
- Parameters:
get_response (
callable
) – The method to execute the view.
- process_view(request, view_func, view_args, view_kwargs)[source]¶
Process the request before calling the view.
This sets up a
local_site
attribute on the request to fetch theLocalSite
used for this view, if any. This is based on thelocal_site_name
key inview_kwargs
.- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.view_func (
callable
) – The view callable.view_args (
tuple
) – Positional arguments passed in to the view.view_kwargs (
dict
) – Keyword argument passed in to the view
- Returns:
The response object.
- Return type:
- __call__(request)[source]¶
Run the middleware.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.- Returns:
The response object.
- Return type: