Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#20599 closed Cleanup/optimization (fixed)

BasePasswordHasher _load_library swallows ImportErrors

Reported by: Jaap Roes Owned by: nobody
Component: contrib.auth Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The _load_library method on BasePasswordHasher turns ImportErrors into ValueErrors, this masks ImportErrors in the algorithm library. I'm proposing a slightly clearer worded error message.

Before:

"Couldn't load foo password algorithm library"

After:

"Couldn't load 'FooHasher' algorithm library: No module named bar"

I'll link to a GitHub pull request after I know the ticket number.

Change History (4)

comment:1 by Jaap Roes, 11 years ago

Has patch: set

Pull request can be found here https://github.com/django/django/pull/1274

comment:2 by Claude Paroz, 11 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Claude Paroz <claude@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 990f8d92dca913462f656387b012801f01c96244:

Fixed #20599 -- Changed wording of ValueError raised by _load_library

The _load_library method on BasePasswordHasher turns ImportErrors
into ValueErrors, this masks ImportErrors in the algorithm library.
Changed it to a clearer worded error message that includes
the ImportError string.

comment:4 by Claude Paroz <claude@…>, 11 years ago

In beb652e069d386fa6295dd235d7ba84a95e9d484:

Worked around Python 3.3 modified exception repr

Refs #20599.

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