Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#879 closed defect (fixed)

Error when loading malformed MIDDLEWARE_CLASSES path

Reported by: anonymous Owned by: Adrian Holovaty
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: no UI/UX: no


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 13 years ago.

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by Noah Slater

Attachment: added


comment:1 Changed 13 years ago by Noah Slater

Attached is how I have patched it localy.

comment:2 Changed 13 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

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

comment:3 Changed 13 years ago by anonymous

Resolution: fixed
Status: closedreopened

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

comment:4 Changed 13 years ago by Noah Slater

Resolution: fixed
Status: reopenedclosed

Fixed as I reopened. Heh.

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