Code Monkey home page Code Monkey logo

Comments (4)

Fantomas42 avatar Fantomas42 commented on August 20, 2024

I would expect an invalid app namespace to either raise an exception (if DEBUG=True) or fail to match any templates. I would expect a valid namespace that doesn't contain the specified template to fail to match. I would expect an empty namespace to match the first app namespace that contains the template according to INSTALLED_APPS order.

This behavior is now fixed.
Thanks for your report.

from django-app-namespace-template-loader.

mrmachine avatar mrmachine commented on August 20, 2024

Thanks for the quick update. This fix also seems to expose another edge case that breaks like #16 -- After making this change, when I specify an invalid app namespace in my {% extends %} tag, I get:

Traceback (most recent call last):
  File "/Users/tailee/.pyenv/versions/2.7.10/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/tailee/.virtualenvs/icekit-sprint/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
    return self.application(environ, start_response)
  File "/Users/tailee/.virtualenvs/icekit-sprint/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 189, in __call__
    response = self.get_response(request)
  File "/Users/tailee/.virtualenvs/icekit-sprint/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/tailee/.virtualenvs/icekit-sprint/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/tailee/.virtualenvs/icekit-sprint/lib/python2.7/site-packages/django/views/debug.py", line 97, in technical_500_response
    html = reporter.get_traceback_html()
  File "/Users/tailee/.virtualenvs/icekit-sprint/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/tailee/.virtualenvs/icekit-sprint/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/tailee/.virtualenvs/icekit-sprint/lib/python2.7/site-packages/django/views/debug.py", line 270, in format_path_status
    if not os.path.exists(path):
  File "/Users/tailee/.virtualenvs/icekit-sprint/lib/python2.7/genericpath.py", line 26, in exists
    os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NamespaceOrigin found

from django-app-namespace-template-loader.

Fantomas42 avatar Fantomas42 commented on August 20, 2024

Which version of Django do you use ?

from django-app-namespace-template-loader.

mrmachine avatar mrmachine commented on August 20, 2024

1.8 Looks like in your tests, you are only calling the app namespace loader. In my project, I have the app namespace loader first, then Django's two default template loaders. It seems that somehow a NamespaceOrigin object is being passed to the Django template loaders, and possible that a TemplateDoesNotExist is being raised, triggering Django's debug view, which is unable to coerce it to text as it attempts to explain the template that doesn't exist.

from django-app-namespace-template-loader.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.