Horizon Middleware

HorizonMiddleware

class horizon.middleware.HorizonMiddleware[source]

The main Horizon middleware class. Required for use of Horizon.

process_exception(request, exception)[source]

Catches internal Horizon exception classes such as NotAuthorized, NotFound and Http302 and handles them gracefully.

process_request(request)[source]

Adds data necessary for Horizon to function to the request.

process_response(request, response)[source]

Convert HttpResponseRedirect to HttpResponse if request is via ajax to allow ajax request to redirect url

OperationLogMiddleware

class horizon.middleware.OperationLogMiddleware[source]

Middleware to output operation log.

This log can includes information below:

  • domain name
  • domain id
  • project name
  • project id
  • user name
  • user id
  • request scheme
  • referer url
  • request url
  • message
  • method
  • http status
  • request parameters

and log format is defined OPERATION_LOG_OPTIONS.

process_exception(request, exception)[source]

Log error info when exception occurred.

process_response(request, response)[source]

Log user operation.