Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#15532 closed (fixed)

Improve error message for django.contrib.auth.load_backend

Reported by: Mikhail Korobov Owned by: nobody
Component: contrib.auth Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi all,

If backend can't be imported for some reason, it now raises the following message (see django.contrib.auth.__init__.py):

    except ImportError, e:
        raise ImproperlyConfigured('Error importing authentication backend %s: "%s"' % (module, e))

This message contains module name. I think it is a good idea to change this to full backend name in order to simplify debugging:

    except ImportError, e:
        raise ImproperlyConfigured('Error importing authentication backend %s: "%s"' % (path, e))

My case: custom django-registration registration backend (with supplying auth backend) that sets user.backend to wrong value (import path was incorrect, class name was correct). It was not easy to determine from existing error message which auth backend is failing because backend class name wasn't in error message.

Change History (3)

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedReady for checkin

comment:2 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

In [15713]:

Fixed #15532 -- Clarified the error message for unknown auth backends. Thanks to kmike for the report.

comment:3 by Russell Keith-Magee, 14 years ago

In [15715]:

(The changeset message doesn't reference this ticket)

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