Middleware: Modernize middleware classes
Make the custom middleware provided by Mayan to use the MiddlewareMixin provide by Django. This make the middleware classes behave like classes or callables. This change ensures compatibility with Django 2.x. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -4,11 +4,12 @@ import logging
|
||||
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import Http404
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ErrorLoggingMiddleware(object):
|
||||
class ErrorLoggingMiddleware(MiddlewareMixin):
|
||||
def process_exception(self, request, exception):
|
||||
if not isinstance(exception, (PermissionDenied, Http404)):
|
||||
# Don't log non critical exceptions
|
||||
|
||||
Reference in New Issue
Block a user