Opened 5 years ago

Closed 3 years ago

#12099 closed Bug (fixed)

admindocs generates an error on the tags page when template tags are included in an egg file

Reported by: Mark S. Choate <mark@…> Owned by: nobody
Component: contrib.admindocs Version: 1.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Alex)

Here is the traceback -- the application appears to be looking on the filesystem for a file that doesn't exist.

Traceback:
File "/.../django/core/handlers/base.py" in get_response
  92.                 response = callback(request, *callback_args, **callback_kwargs)
File "/.../django/contrib/admin/views/decorators.py" in _checklogin
  33.             return view_func(request, *args, **kwargs)
File "/...o/django/contrib/admindocs/views.py" in template_tag_index
  54.     load_all_installed_template_libraries()
File "/.../django/contrib/admindocs/views.py" in load_all_installed_template_libraries
  313.         libraries = [os.path.splitext(p)[0] for p in os.listdir(e) if p.endswith('.py') and p[0].isalpha()]

Exception Type: OSError at /admin/doc/tags/

Change History (6)

comment:1 Changed 5 years ago by Alex

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Please use preview.

comment:2 Changed 5 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 4 years ago by julien

  • Severity set to Normal
  • Type set to Bug

comment:4 Changed 3 years ago by ramiro

  • Component changed from contrib.admin to contrib.admindocs
  • Easy pickings unset
  • UI/UX unset

comment:5 Changed 3 years ago by aaugustin

I'm going to fix this by adopting a pattern similar to django.core.management.find_commands. Template tag libraries won't be found in eggs, but at least Django won't crash.

This is difficult to test. Here's one way to simulate the problem manually:

  • create a unused templatetags package in an app: mkdir django/contrib/auth/templatetags; touch mkdir django/contrib/auth/templatetags/__init__.py
  • run the development server and load the admin doc page to warm the templatetags libraries cache
  • make the templatetags package unreadable: chown -r django/contrib/auth/templatetags
  • reload the admin doc page

comment:6 Changed 3 years ago by aaugustin

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

In [17401]:

(The changeset message doesn't reference this ticket)

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