Code

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#20599 closed Cleanup/optimization (fixed)

BasePasswordHasher _load_library swallows ImportErrors

Reported by: jaap3 Owned by: nobody
Component: contrib.auth Version: master
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.

Attachments (0)

Change History (4)

comment:1 Changed 10 months ago by jaap3

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 10 months ago by claudep

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 10 months ago by Claude Paroz <claude@…>

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

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 Changed 10 months ago by Claude Paroz <claude@…>

In beb652e069d386fa6295dd235d7ba84a95e9d484:

Worked around Python 3.3 modified exception repr

Refs #20599.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.