Ticket #6412: tmp.patch

File tmp.patch, 1.4 KB (added by mbeachy@…, 17 years ago)

simple debug.py patch to report non-readability of template files

  • django/views/debug.py

     
    8282                source_list_func = getattr(__import__(loader.__module__, {}, {}, ['get_template_sources']), 'get_template_sources')
    8383                # NOTE: This assumes exc_value is the name of the template that
    8484                # the loader attempted to load.
    85                 template_list = [{'name': t, 'exists': os.path.exists(t)} \
     85                template_list = [{'name': t,
     86                                  'exists': os.path.exists(t),
     87                                  'readable': os.access(t, os.R_OK)}
    8688                    for t in source_list_func(str(exc_value))]
    8789            except (ImportError, AttributeError):
    8890                template_list = []
     
    392394        <ul>
    393395        {% for loader in loader_debug_info %}
    394396            <li>Using loader <code>{{ loader.loader }}</code>:
    395                 <ul>{% for t in loader.templates %}<li><code>{{ t.name }}</code> (File {% if t.exists %}exists{% else %}does not exist{% endif %})</li>{% endfor %}</ul>
     397                <ul>{% for t in loader.templates %}<li><code>{{ t.name }}</code> (File {% if t.exists %}exists{% if not t.readable %} but is not readable{% endif %}{% else %}does not exist{% endif %})</li>{% endfor %}</ul>
    396398            </li>
    397399        {% endfor %}
    398400        </ul>
Back to Top