Tweaks I mentioned earlier in #flux on IRC #9

Merged
merged 1 commit into from Jul 22, 2011

Projects

None yet

2 participants

Contributor

With the last commit from davedash, I could switch between Jinja and Django per-app.

But, since jingo.Loader directly invoked Django's app_directories.Loader for excluded apps, the filesystem.Loader never got called. So, I couldn't override Django templates from 3rd party apps at the top level of the project.

So... this commit contains tweaks to fix this, tests to show it works, and a renaming of the setting to JINGO_EXCLUDE_APPS because that makes more sense to me.

@davedash davedash commented on an outdated diff Jul 20, 2011
docs/index.rst
@@ -40,7 +41,7 @@ This will let you use ``django.shortcuts.render`` or
And finally you may have apps that do not use Jinja2, these must be excluded
from the loader::
- DJANGO_TEMPLATE_APPS = ('debug_toolbar',)
+ JINGO_EXCLUDE_APPS = ('debug_toolbar',)
If a template is in the *app folder*, `debug_toolbar`, Django will handle the
davedash
davedash Jul 20, 2011 Collaborator

Update this sentence so it fits what the code is doing. maybe: If jingo.Loader encounters a template in debug_toolbar, we raise templatenotfound and the next loader will try to handle it.

Collaborator

The bulk of this looks good... make the doc correction and maybe amend the commit text, and I'll mergify

@lmorchard lmorchard Make jingo.Loader properly fall back to other TEMPLATE_LOADERS
- jingo.Loader raises TemplateDoesNotExist when excluded app
  encountered, which causes fallback to the next loader listed in
  settings.TEMPLATE_LOADERS

- renamed setting DJANGO_TEMPLATE_APPS -> JINGO_EXCLUDE_APPS

- tests updated to ensure top-level override of app-level templates
  works for both Jinja and Django loaders
0bb713a
Contributor

how 'bout that ^^

@davedash davedash merged commit b4ecca1 into jbalogh:master Jul 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment