Permalink
Browse files

Using new Jingo Loader

  • Loading branch information...
1 parent 99e469f commit e5a081c89538307eb4528febafd022f378e754ef @davedash davedash committed Oct 25, 2011
Showing with 9 additions and 12 deletions.
  1. +1 −1 apps/input/tests/__init__.py
  2. +1 −6 apps/search/tests/test_dashboard.py
  3. +4 −4 apps/search/views.py
  4. +3 −1 settings.py
@@ -32,7 +32,7 @@ def wrapped(*args, **kwargs):
def render(s, context={}):
"""Render a Jinja2 template fragment."""
t = jingo.env.from_string(s)
- return t.render(**context)
+ return t.render(context)
class InputTestCase(test_utils.TestCase):
@@ -10,16 +10,11 @@
import input
from feedback.cron import populate
-from input.tests import InputTestCase
+from input.tests import InputTestCase, render
from input.urlresolvers import reverse
from search.tests import SphinxTestCase
-def render(s, context={}):
- t = jingo.env.from_string(s)
- return t.render(**context)
-
-
def render_template(template, context):
"""Helper rendering a Jinja template."""
t = register.env.get_template(template).render(context)
View
@@ -6,10 +6,10 @@
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
from django.core.paginator import Paginator, InvalidPage, EmptyPage
+from django.shortcuts import render
from django.utils.feedgenerator import Atom1Feed
import commonware.log
-import jingo
from product_details.version_compare import Version
from tower import ugettext as _, ugettext_lazy as _lazy
@@ -213,8 +213,8 @@ def index(request):
(results, form, product, version, metas, type_filter) = _get_results(
request, meta=meta)
except SearchError, e:
- return jingo.render(request, 'search/unavailable.html',
- {'search_error': e}, status=500)
+ return render(request, 'search/unavailable.html', {'search_error': e},
+ status=500)
page = form.data.get('page', 1)
@@ -282,4 +282,4 @@ def index(request):
data['defaults'] = get_defaults(form)
template = 'search/%ssearch.html' % (
'mobile/' if request.mobile_site else '')
- return jingo.render(request, template, data)
+ return render(request, template, data)
View
@@ -139,9 +139,9 @@ def __new__(self):
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
+ 'jingo.Loader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
-# 'django.template.loaders.eggs.Loader',
)
TEMPLATE_CONTEXT_PROCESSORS = (
@@ -240,6 +240,8 @@ def JINJA_CONFIG():
'finalize': lambda x: x if x is not None else ''}
return config
+JINGO_EXCLUDE_APPS = ['debug_toolbar', 'admin']
+
MIDDLEWARE_CLASSES = (
'input.middleware.MobileSiteMiddleware',
'input.middleware.LocaleURLMiddleware',

0 comments on commit e5a081c

Please sign in to comment.