The Middlewares¶
-
class
fusionbox.middleware.
GenericTemplateFinderMiddleware
[source]¶ Response middleware that uses
generic_template_finder_view()
to attempt to autolocate a template for otherwise 404 responses.-
process_response
(request, response)[source]¶ Ensures that 404 raised from view functions are not caught by
GenericTemplateFinderMiddleware
.
-
process_view
(request, view_func, view_args, view_kwargs)[source]¶ Informs
process_response()
that there was a view for this url and that it threw a real 404.
-
-
class
fusionbox.middleware.
Redirect
(source, target, status_code, filename, line_number)[source]¶ Encapulates all of the information about a redirect.
-
class
fusionbox.middleware.
RedirectFallbackMiddleware
(*args, **kwargs)[source]¶ This middleware handles 3xx redirects and 410s.
Only 404 responses will be redirected, so if something else is returning a non 404 error, this middleware will not produce a redirect
Redirects should be formatted in CSV files located in either
<project_path>/redirects/
or an absolute path declared insettings.REDIRECTS_DIRECTORY
.CSV files should not contain any headers, and be in the format
source_url, target_url, status_code
wherestatus_code
is optional and defaults to 301. To issue a 410, leave off target url and status code.