"""
from __future__ import unicode_literals
from hashlib import md5
-from django import template
+from django.template import Node
+
+try:
+ # Django < 1.9
+ from django.template.base import get_library
+except:
+ from importlib import import_module
+ from django.template.backends.django import get_installed_libraries
+
+ def get_library(taglib):
+ if not hasattr(get_library, 'libraries'):
+ get_library.libraries = get_installed_libraries()
+ if isinstance(get_library.libraries[taglib], str):
+ get_library.libraries[taglib] = import_module(get_library.libraries[taglib]).register
+ return get_library.libraries[taglib]
+
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.functional import Promise
from django.utils.safestring import mark_safe
def get_value(self, request):
"""Computes the real value of the variable, using the request."""
taglib, tagname = self.tagpath.rsplit('.', 1)
- return template.get_library(taglib).tags[tagname].get_value(
+ return get_library(taglib).tags[tagname].get_value(
request, *self.args, **self.kwargs)
def __str__(self):
return type_(var)
-class SsiVariableNode(template.Node):
+class SsiVariableNode(Node):
""" Node for the SsiVariable tags. """
def __init__(self, tagpath, args, kwargs, patch_response=None, asvar=None):
self.tagpath = tagpath