Opened 6 years ago

Closed 6 years ago

#10887 closed (fixed)

admin.autodiscover

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

Description

In django/contrib/admin/__init__.py, I suggest to change the following code:

    try:
        app_path = import_module(app).__path__
    except AttributeError:
        continue

into:

    mod = import_module(app)
    try:
        app_path = mod.__path__
    except AttributeError:
        continue

Otherwise there is a probably not intended behaviour if one of my modules is buggy and raises itself an AttributeError.

Attachments (1)

10887.diff (635 bytes) - added by SmileyChris 6 years ago.

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by SmileyChris

comment:1 Changed 6 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

Agreed

comment:2 Changed 6 years ago by adrian

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

(In [12192]) Fixed #10887 -- Fixed a possible gotcha in admin.autodiscover() by moving import_module() outside the try/except. Thanks, lsaffre

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