Fantomas42 / django-app-namespace-template-loader

Template loader allowing you to both extend and override a template at the same time.
BSD 3-Clause "New" or "Revised" License
59 stars 18 forks source link

Misleading error in namespace violation(?) #19

Closed cogat closed 7 years ago

cogat commented 7 years ago

See https://github.com/ic-labs/django-icekit/issues/162

I assume to reproduce the error, one would override a template that extends from a template in a different app namespace.

The error can't be rendered by the technical 500 view (see stacktrace below), and shows up as a TemplateDoesNotExist: icekit_plugins_file:icekit/plugins/contact_person/default.html in an error log.

A more friendly error than 'TemplateDoesNotExist' would be helpful, but I'm not sure enough about what's going on to be able to suggest one.


  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/gturner/Sites/acmi/var/go.sh-venv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
    return self.application(environ, start_response)
  File "/Users/gturner/Sites/acmi/var/go.sh-venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 189, in __call__
    response = self.get_response(request)
  File "/Users/gturner/Sites/acmi/var/go.sh-venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 218, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/Users/gturner/Sites/acmi/var/go.sh-venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 261, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/Users/gturner/Sites/acmi/var/go.sh-venv/lib/python2.7/site-packages/django/views/debug.py", line 97, in technical_500_response
    html = reporter.get_traceback_html()
  File "/Users/gturner/Sites/acmi/var/go.sh-venv/lib/python2.7/site-packages/django/views/debug.py", line 383, in get_traceback_html
    c = Context(self.get_traceback_data(), use_l10n=False)
  File "/Users/gturner/Sites/acmi/var/go.sh-venv/lib/python2.7/site-packages/django/views/debug.py", line 313, in get_traceback_data
    } for t in source_list_func(str(self.exc_value))]
  File "/Users/gturner/Sites/acmi/var/go.sh-venv/lib/python2.7/site-packages/django/views/debug.py", line 270, in format_path_status
    if not os.path.exists(path):
  File "/Users/gturner/Sites/acmi/var/go.sh-venv/bin/../lib/python2.7/genericpath.py", line 18, in exists
    os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NamespaceOrigin found```
Fantomas42 commented 7 years ago

Hello,

the traceback says that it's django itself that raise this error, so I don't see how to make this error sounding more friendly...

Best regards