Comments (4)
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.
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.
Which version of Django do you use ?
from django-app-namespace-template-loader.
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)
- Support for extending the default template without recursion HOT 2
- App doesn't work with dotted paths in INSTALLED_APPS HOT 3
- Django 1.9 compatibility HOT 5
- Awareness of similar project? HOT 16
- Exception on second render of template when `app_namespace.Loader` is not first. HOT 5
- Doesn't work expectantly when use {% extends %} template tag. HOT 7
- Misleading error in namespace violation(?) HOT 1
- Django 3 compatibility
- TEMPLATE_LOADERS deprecated in 1.8 HOT 5
- 'Loader' object has no attribute 'make_origin' HOT 1
- I think it's a bug HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-app-namespace-template-loader.