diff --git a/.travis.yml b/.travis.yml index 700d1bf..5eee6a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,11 @@ env: - TOX_ENV=py27-1.5 - TOX_ENV=py27-1.6 - TOX_ENV=py27-1.7 + - TOX_ENV=py27-1.8 - TOX_ENV=py33-1.5 - TOX_ENV=py33-1.6 - TOX_ENV=py33-1.7 + - TOX_ENV=py33-1.8 install: - pip install tox script: diff --git a/jingo/__init__.py b/jingo/__init__.py index e4011f8..8dce400 100644 --- a/jingo/__init__.py +++ b/jingo/__init__.py @@ -9,12 +9,23 @@ import re from django.conf import settings from django.template.base import Origin, TemplateDoesNotExist -from django.template.context import get_standard_processors from django.template.loader import BaseLoader from django.utils.importlib import import_module import jinja2 +try: + from django.template.engine import Engine + + has_engine = True + + def get_standard_processors(): + return Engine.get_default().template_context_processors + +except ImportError: + from django.template.context import get_standard_processors + has_engine = False + VERSION = (0, 7, 1) __version__ = '.'.join(map(str, VERSION)) @@ -200,7 +211,10 @@ class Loader(BaseLoader): env.template_class = Template def __init__(self): - super(Loader, self).__init__() + if has_engine: + super(Loader, self).__init__(Engine.get_default()) + else: + super(Loader, self).__init__() include_pattern = getattr(settings, 'JINGO_INCLUDE_PATTERN', None) if include_pattern: self.include_re = re.compile(include_pattern) diff --git a/jingo/monkey.py b/jingo/monkey.py index ec60efd..614f705 100644 --- a/jingo/monkey.py +++ b/jingo/monkey.py @@ -86,16 +86,19 @@ def patch(): # Replace StrAndUnicode with SafeStrAndUnicode in the inheritance # for all these classes. - classes = ( + classes = [ forms.BaseForm, forms.BoundField, formsets.BaseFormSet, util.ErrorDict, util.ErrorList, widgets.Media, - widgets.RadioInput, widgets.RadioFieldRenderer, - ) + ] + try: + classes.append(widgets.RadioChoiceInput) + except AttributeError: + classes.append(widgets.RadioInput) if has_str_and_unicode: for cls in classes: diff --git a/tox.ini b/tox.ini index e95f7ad..f05a4c6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26-1.4, py26-1.5, py26-1.6, py27-1.4, py27-1.5, py27-1.6, py27-1.7, py33-1.5, py33-1.6, py33-1.7 +envlist = py26-1.4, py26-1.5, py26-1.6, py27-1.4, py27-1.5, py27-1.6, py27-1.7, py27-1.8, py33-1.5, py33-1.6, py33-1.7, py33-1.8 toxworkdir = {homedir}/.tox-jingo [testenv] @@ -53,6 +53,12 @@ deps = Django>=1.7,<1.8 {[testenv]deps} +[testenv:py27-1.8] +basepython = python2.7 +deps = + Django>=1.8,<1.9 + {[testenv]deps} + [testenv:py33-1.5] basepython = python3.3 deps = @@ -70,3 +76,9 @@ basepython = python3.3 deps = Django>=1.7,<1.8 {[testenv]deps} + +[testenv:py33-1.8] +basepython = python3.3 +deps = + Django>=1.8,<1.9 + {[testenv]deps}