Closed
Description
debug_toolbar.apps.is_middlware_class()
is used in a check for middleware ordering issues.
It assumes that all middleware in MIDDLEWARE
are classes and doesn't account for Django 1.10's functional middleware.
If a functional middleware factory is present, it fails when it hits issubclass()
since the first argument isn't a class.
I will try to submit a patch this weekend because I need to clone the project and get the test suite running but a simple solution would be tweak it:
def is_middleware_class(middleware_class, middleware_path):
try:
middleware_cls = import_string(middleware_path)
except ImportError:
return
try:
return issubclass(middleware_cls, middleware_class)
except TypeError:
return False
Perhaps there is a more elegant check using the types
module but I would need to read about Py2/3 compatibility.
Metadata
Metadata
Assignees
Labels
No labels