Opened 7 years ago

Closed 5 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 Gaynor)

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 7 years ago by Alex Gaynor

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

Please use preview.

comment:2 Changed 7 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

comment:3 Changed 5 years ago by Julien Phalip

Severity: Normal
Type: Bug

comment:4 Changed 5 years ago by Ramiro Morales

Component: contrib.admincontrib.admindocs
Easy pickings: unset
UI/UX: unset

comment:5 Changed 5 years ago by Aymeric Augustin

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 5 years ago by Aymeric Augustin

Resolution: fixed
Status: newclosed

In [17401]:

(The changeset message doesn't reference this ticket)

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