Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#879 closed defect (fixed)

Error when loading malformed MIDDLEWARE_CLASSES path

Reported by: anonymous Owned by: adrian
Component: Core (Other) Version:
Severity: normal Keywords: middleware core
Cc: nslater@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


If the settings file defines the middleware classes like this:


The following code found in /core/handlers/ when calling load_middleware():

        for middleware_path in settings.MIDDLEWARE_CLASSES:
                dot = middleware_path.rindex('.')
                mw_module, mw_classname = middleware_path[:dot], middleware_path[dot+1:]
            except ValueError:
                raise exceptions.ImproperlyConfigured, '"%s" does not look like a middleware module' % (middleware_path)

will throw a ValueError when attempting the rindex('.') method call.

Attachments (1) (1011 bytes) - added by Noah Slater 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by Noah Slater


comment:1 Changed 10 years ago by Noah Slater

Attached is how I have patched it localy.

comment:2 Changed 10 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(In [1355]) Fixed #879 -- Middleware loader now throws a better error for MIDDLEWARE_CLASSES value without a dot. Thanks, Noah Slater

comment:3 Changed 10 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

No problem! The grammar of the error message in [1355] has been mangled however. :)

comment:4 Changed 10 years ago by Noah Slater

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed as I reopened. Heh.

Note: See TracTickets for help on using tickets.
Back to Top