[Python-modules-commits] [django-jinja] 01/03: Import django-jinja-2.1.1.orig.tar.gz
Edward Betts
edward at moszumanska.debian.org
Wed Dec 23 12:35:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
edward pushed a commit to tag debian/2.1.1-1
in repository django-jinja.
commit f1211bbe22e36f6841855e5e0b939d32ab5d6b3c
Author: Edward Betts <edward at 4angle.com>
Date: Wed Dec 23 10:50:02 2015 +0000
Import django-jinja-2.1.1.orig.tar.gz
---
PKG-INFO | 5 +-
README.rst | 6 +-
django_jinja.egg-info/PKG-INFO | 5 +-
django_jinja.egg-info/requires.txt | 2 +-
django_jinja/apps.py | 3 -
django_jinja/backend.py | 134 ++++++++++-
django_jinja/base.py | 281 ++---------------------
django_jinja/cache.py | 10 +-
django_jinja/library.py | 3 +-
django_jinja/management/commands/makemessages.py | 4 +
setup.py | 7 +-
11 files changed, 171 insertions(+), 289 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 736e3ad..db4b6f5 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,8 +1,8 @@
Metadata-Version: 1.1
Name: django-jinja
-Version: 1.4.1
+Version: 2.1.1
Summary: Jinja2 templating language integrated in Django.
-Home-page: https://github.com/niwibe/django-jinja
+Home-page: https://github.com/niwinz/django-jinja
Author: Andrey Antukh
Author-email: niwi at niwi.be
License: BSD
@@ -18,7 +18,6 @@ Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Internet :: WWW/HTTP
diff --git a/README.rst b/README.rst
index 1ff4f75..0d095c2 100644
--- a/README.rst
+++ b/README.rst
@@ -6,8 +6,8 @@ Simple and nonobstructive jinja2 integration with Django.
**Now with support for django 1.8**
-.. image:: https://img.shields.io/travis/niwibe/django-jinja.svg?style=flat
- :target: https://travis-ci.org/niwibe/django-jinja
+.. image:: https://img.shields.io/travis/niwinz/django-jinja.svg?style=flat
+ :target: https://travis-ci.org/niwinz/django-jinja
.. image:: https://img.shields.io/pypi/v/django-jinja.svg?style=flat
:target: https://pypi.python.org/pypi/django-jinja
@@ -16,7 +16,7 @@ Simple and nonobstructive jinja2 integration with Django.
:target: https://pypi.python.org/pypi/django-jinja
-**Documentation:** http://niwibe.github.io/django-jinja/
+**Documentation:** http://niwinz.github.io/django-jinja/
How to install?
diff --git a/django_jinja.egg-info/PKG-INFO b/django_jinja.egg-info/PKG-INFO
index 736e3ad..db4b6f5 100644
--- a/django_jinja.egg-info/PKG-INFO
+++ b/django_jinja.egg-info/PKG-INFO
@@ -1,8 +1,8 @@
Metadata-Version: 1.1
Name: django-jinja
-Version: 1.4.1
+Version: 2.1.1
Summary: Jinja2 templating language integrated in Django.
-Home-page: https://github.com/niwibe/django-jinja
+Home-page: https://github.com/niwinz/django-jinja
Author: Andrey Antukh
Author-email: niwi at niwi.be
License: BSD
@@ -18,7 +18,6 @@ Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Internet :: WWW/HTTP
diff --git a/django_jinja.egg-info/requires.txt b/django_jinja.egg-info/requires.txt
index f2a3150..a508761 100644
--- a/django_jinja.egg-info/requires.txt
+++ b/django_jinja.egg-info/requires.txt
@@ -1,2 +1,2 @@
jinja2 >=2.5
-django >=1.4
+django >=1.8
diff --git a/django_jinja/apps.py b/django_jinja/apps.py
index 760b4fc..9f0d196 100644
--- a/django_jinja/apps.py
+++ b/django_jinja/apps.py
@@ -10,6 +10,3 @@ class DjangoJinjaAppConfig(AppConfig):
def ready(self):
base.patch_django_for_autoescape()
-
- if django.VERSION[:2] == (1, 7):
- base.setup()
diff --git a/django_jinja/backend.py b/django_jinja/backend.py
index 6eff1b0..0088ee8 100644
--- a/django_jinja/backend.py
+++ b/django_jinja/backend.py
@@ -11,6 +11,8 @@ from __future__ import absolute_import
import copy
import sys
+import os
+import os.path as path
from importlib import import_module
import jinja2
@@ -34,14 +36,32 @@ from django.utils.module_loading import import_string
from . import base
from . import builtins
+from . import library
from . import utils
+class Origin(object):
+ """
+ A container to hold debug information as described in the template API
+ documentation.
+ """
+ def __init__(self, name, template_name):
+ self.name = name
+ self.template_name = template_name
+
+
class Template(object):
def __init__(self, template, backend):
self.template = template
self.backend = backend
+ self._debug = False
+ self.origin = Origin(name=template.filename, template_name=template.name)
+
+ @property
+ def name(self):
+ return self.origin.name
+
def render(self, context=None, request=None):
if context is None:
context = {}
@@ -61,6 +81,27 @@ class Template(object):
for processor in self.backend.context_processors:
context.update(processor(request))
+ if self.backend._tmpl_debug:
+ from django.test import signals
+ from django.template.context import BaseContext
+
+ # Define a "django" like context for emitatet the multi
+ # layered context object. This is mainly for apps like
+ # django-debug-toolbar that are very coupled to django's
+ # internal implementation of context.
+
+ if not isinstance(context, BaseContext):
+ class CompatibilityContext(dict):
+ @property
+ def dicts(self):
+ return [self]
+
+ context = CompatibilityContext(context)
+
+ signals.template_rendered.send(sender=self, template=self,
+ context=context)
+
+
return self.template.render(context)
@@ -111,6 +152,12 @@ class Jinja2(BaseEngine):
extra_constants = options.pop("constants", {})
translation_engine = options.pop("translation_engine", "django.utils.translation")
+ tmpl_debug = options.pop("debug", settings.DEBUG)
+ bytecode_cache = options.pop("bytecode_cache", {})
+ bytecode_cache.setdefault("name", "default")
+ bytecode_cache.setdefault("enabled", False)
+ bytecode_cache.setdefault("backend", "django_jinja.cache.BytecodeCache")
+
undefined = options.pop("undefined", None)
if undefined is not None:
if isinstance(undefined, six.string_types):
@@ -132,10 +179,6 @@ class Jinja2(BaseEngine):
self.env = environment_cls(**options)
- self._context_processors = context_processors
- self._match_regex = match_regex
- self._match_extension = match_extension
-
# Initialize i18n support
if settings.USE_I18N:
translation = import_module(translation_engine)
@@ -143,12 +186,48 @@ class Jinja2(BaseEngine):
else:
self.env.install_null_translations(newstyle=newstyle_gettext)
+ self._context_processors = context_processors
+ self._match_regex = match_regex
+ self._match_extension = match_extension
+ self._tmpl_debug = tmpl_debug
+ self._bytecode_cache = bytecode_cache
+
self._initialize_builtins(filters=extra_filters,
tests=extra_tests,
globals=extra_globals,
constants=extra_constants)
- base._initialize_thirdparty(self.env)
+ self._initialize_thirdparty()
+ self._initialize_bytecode_cache()
+
+
+
+ def _initialize_bytecode_cache(self):
+ if self._bytecode_cache["enabled"]:
+ cls = utils.load_class(self._bytecode_cache["backend"])
+ self.env.bytecode_cache = cls(self._bytecode_cache["name"])
+
+ def _initialize_thirdparty(self):
+ """
+ Iterate over all available apps in searching and preloading
+ available template filters or functions for jinja2.
+ """
+ for app_path, mod_path in base._iter_templatetags_modules_list():
+ if not path.isdir(mod_path):
+ continue
+
+ for filename in filter(lambda x: x.endswith(".py") or x.endswith(".pyc"), os.listdir(mod_path)):
+ # Exclude __init__.py files
+ if filename == "__init__.py" or filename == "__init__.pyc":
+ continue
+
+ file_mod_path = "%s.templatetags.%s" % (app_path, filename.rsplit(".", 1)[0])
+ try:
+ import_module(file_mod_path)
+ except ImportError:
+ pass
+
+ library._update_env(self.env)
def _initialize_builtins(self, filters=None, tests=None, globals=None, constants=None):
def insert(data, name, value):
@@ -186,22 +265,57 @@ class Jinja2(BaseEngine):
def match_template(self, template_name):
return base.match_template(template_name,
- regex=self._match_regex,
- extension=self._match_extension)
+ self._match_extension,
+ self._match_regex)
def get_template(self, template_name):
if not self.match_template(template_name):
- raise TemplateDoesNotExist("Template {} does not exists".format(template_name))
+ message = "Template {} does not exists".format(template_name)
+ raise TemplateDoesNotExist(message)
try:
return Template(self.env.get_template(template_name), self)
except jinja2.TemplateNotFound as exc:
- six.reraise(TemplateDoesNotExist, TemplateDoesNotExist(exc.args), sys.exc_info()[2])
+ six.reraise(
+ TemplateDoesNotExist,
+ TemplateDoesNotExist(exc.name, backend=self),
+ sys.exc_info()[2],
+ )
except jinja2.TemplateSyntaxError as exc:
- six.reraise(TemplateSyntaxError, TemplateSyntaxError(exc.args), sys.exc_info()[2])
+ new = TemplateSyntaxError(exc.args)
+ new.template_debug = get_exception_info(exc)
+ six.reraise(TemplateSyntaxError, new, sys.exc_info()[2])
+
@receiver(signals.setting_changed)
def _setting_changed(sender, setting, *args, **kwargs):
""" Reset the Jinja2.get_default() cached when TEMPLATES changes. """
if setting == "TEMPLATES":
Jinja2.get_default.cache_clear()
+
+
+def get_exception_info(exception):
+ """
+ Formats exception information for display on the debug page using the
+ structure described in the template API documentation.
+ """
+ context_lines = 10
+ lineno = exception.lineno
+ lines = list(enumerate(exception.source.strip().split("\n"), start=1))
+ during = lines[lineno - 1][1]
+ total = len(lines)
+ top = max(0, lineno - context_lines - 1)
+ bottom = min(total, lineno + context_lines)
+
+ return {
+ 'name': exception.filename,
+ 'message': exception.message,
+ 'source_lines': lines[top:bottom],
+ 'line': lineno,
+ 'before': '',
+ 'during': during,
+ 'after': '',
+ 'total': total,
+ 'top': top,
+ 'bottom': bottom,
+ }
diff --git a/django_jinja/base.py b/django_jinja/base.py
index c42d8a8..005d895 100644
--- a/django_jinja/base.py
+++ b/django_jinja/base.py
@@ -1,35 +1,14 @@
# -*- coding: utf-8 -*-
-import os
+
import re
+import os
+import os.path as path
from importlib import import_module
import django
-import jinja2
from django.conf import settings
from django.template.context import BaseContext
-from django.test.signals import setting_changed
from django.utils import six
-from jinja2.loaders import BaseLoader
-
-from . import builtins
-from . import library
-from . import utils
-
-JINJA2_ENVIRONMENT_OPTIONS = getattr(settings, "JINJA2_ENVIRONMENT_OPTIONS", {})
-JINJA2_EXTENSIONS = getattr(settings, "JINJA2_EXTENSIONS", builtins.DEFAULT_EXTENSIONS)
-JINJA2_AUTOESCAPE = getattr(settings, "JINJA2_AUTOESCAPE", True)
-JINJA2_UNDEFINED = getattr(settings, "JINJA2_UNDEFINED", None)
-JINJA2_NEWSTYLE_GETTEXT = getattr(settings, "JINJA2_NEWSTYLE_GETTEXT", True)
-
-JINJA2_BYTECODE_CACHE_ENABLE = getattr(settings, "JINJA2_BYTECODE_CACHE_ENABLE", False)
-JINJA2_BYTECODE_CACHE_NAME = getattr(settings, "JINJA2_BYTECODE_CACHE_NAME", "default")
-JINJA2_BYTECODE_CACHE_BACKEND = getattr(settings, "JINJA2_BYTECODE_CACHE_BACKEND",
- "django_jinja.cache.BytecodeCache")
-JINJA2_TRANSLATION_ENGINE = getattr(settings, "JINJA2_TRANSLATION_ENGINE", "django.utils.translation")
-JINJA2_CONSTANTS = getattr(settings, "JINJA2_CONSTANTS", {})
-JINJA2_TESTS = getattr(settings, "JINJA2_TESTS", {})
-JINJA2_FILTERS = getattr(settings, "JINJA2_FILTERS", {})
-JINJA2_GLOBALS = getattr(settings, "JINJA2_GLOBALS", {})
def dict_from_context(context):
@@ -46,56 +25,13 @@ def dict_from_context(context):
return dict(context)
-class Template(jinja2.Template):
- """
- Customized jinja2 Template subclass.
- Add correct handling django context objects.
- """
-
- def render(self, context={}):
- new_context = dict_from_context(context)
- if settings.TEMPLATE_DEBUG:
- from django.test import signals
-
- # Define a "django" like context for emitatet the multi
- # layered context object. This is mainly for apps like
- # django-debug-toolbar that are very coupled to django's
- # internal implementation of context.
-
- if not isinstance(context, BaseContext):
- class CompatibilityContext(dict):
- @property
- def dicts(self):
- return [self]
-
- context = CompatibilityContext(context)
-
- signals.template_rendered.send(sender=self, template=self,
- context=context)
-
- return super(Template, self).render(new_context)
-
- def stream(self, context={}):
- new_context = dict_from_context(context)
- if settings.TEMPLATE_DEBUG:
- from django.test import signals
- # self.origin = Origin(self.filename)
- signals.template_rendered.send(sender=self, template=self, context=context)
-
- return super(Template, self).stream(new_context)
-
-
def _iter_templatetags_modules_list():
"""
Get list of modules that contains templatetags
submodule.
"""
- # Django 1.7 compatibility imports
- try:
- from django.apps import apps
- all_modules = [x.name for x in apps.get_app_configs()]
- except ImportError:
- all_modules = settings.INSTALLED_APPS
+ from django.apps import apps
+ all_modules = [x.name for x in apps.get_app_configs()]
for app_path in all_modules:
try:
@@ -103,7 +39,7 @@ def _iter_templatetags_modules_list():
# Empty folders can lead to unexpected behavior with Python 3.
# We make sure to have the `__file__` attribute.
if hasattr(mod, '__file__'):
- yield (app_path, os.path.dirname(mod.__file__))
+ yield (app_path, path.dirname(mod.__file__))
except ImportError:
pass
@@ -115,15 +51,8 @@ def patch_django_for_autoescape():
"""
from django.utils import safestring
from django.forms.forms import BoundField
-
- try:
- from django.forms.utils import ErrorList
- from django.forms.utils import ErrorDict
-
- # Just for django < 1.7 compatibility
- except ImportError:
- from django.forms.util import ErrorList
- from django.forms.util import ErrorDict
+ from django.forms.utils import ErrorList
+ from django.forms.utils import ErrorDict
if hasattr(safestring, "SafeText"):
if not hasattr(safestring.SafeText, "__html__"):
@@ -151,91 +80,29 @@ def patch_django_for_autoescape():
ErrorDict.__html__ = lambda self: six.text_type(self)
-def _initialize_thirdparty(env):
- """
- Iterate over all available apps in searching and preloading
- available template filters or functions for jinja2.
+def get_match_extension(using=None):
"""
- for app_path, mod_path in _iter_templatetags_modules_list():
- if not os.path.isdir(mod_path):
- continue
-
- for filename in filter(lambda x: x.endswith(".py") or x.endswith(".pyc"), os.listdir(mod_path)):
- # Exclude __init__.py files
- if filename == "__init__.py" or filename == "__init__.pyc":
- continue
-
- file_mod_path = "%s.templatetags.%s" % (app_path, filename.rsplit(".", 1)[0])
- try:
- import_module(file_mod_path)
- except ImportError:
- pass
+ Gets the extension that the template loader will match for
+ django-jinja. This returns Jinja2.match_extension.
- library._update_env(env)
-
-
-def _initialize_builtins(env):
+ The "using" parameter selects with Jinja2 backend to use if
+ you have multiple ones configured in settings.TEMPLATES.
+ If it is None and only one Jinja2 backend is defined then it
+ will use that, otherwise an ImproperlyConfigured exception
+ is thrown.
"""
- Inject into environment instances builtin
- filters, tests, globals, and constants.
- """
- for name, value in JINJA2_FILTERS.items():
- if isinstance(value, six.string_types):
- env.filters[name] = utils.load_class(value)
- else:
- env.filters[name] = value
+ from .backend import Jinja2
+ from django.template import engines
- for name, value in JINJA2_TESTS.items():
- if isinstance(value, six.string_types):
- env.tests[name] = utils.load_class(value)
- else:
- env.tests[name] = value
-
- for name, value in JINJA2_GLOBALS.items():
- if isinstance(value, six.string_types):
- env.globals[name] = utils.load_class(value)
- else:
- env.globals[name] = value
-
- for name, value in JINJA2_CONSTANTS.items():
- env.globals[name] = value
-
-
-def _initialize_i18n(env):
- # install translations
- if settings.USE_I18N:
- translation = import_module(JINJA2_TRANSLATION_ENGINE)
- env.install_gettext_translations(translation, newstyle=JINJA2_NEWSTYLE_GETTEXT)
+ if using is None:
+ engine = Jinja2.get_default()
else:
- env.install_null_translations(newstyle=JINJA2_NEWSTYLE_GETTEXT)
+ engine = engines[using]
+ return engine.match_extension
-def _initialize_template_loader(env):
- loader = getattr(settings, "JINJA2_LOADER", None)
-
- if isinstance(loader, six.string_types):
- cls = utils.load_class(loader)
- env.loader = cls()
- elif isinstance(loader, BaseLoader):
- env.loader = loader
- elif loader is None:
- # Create a default loader using django template dirs
- # and django app template dirs.
- from django.template.loaders import app_directories
- default_loader_dirs = (tuple(settings.TEMPLATE_DIRS) +
- app_directories.app_template_dirs)
- env.loader = jinja2.FileSystemLoader(default_loader_dirs)
- else:
- raise RuntimeError("Wrong parameters to 'JINJA2_LOADER'")
-
-def _initialize_bytecode_cache(env):
- if JINJA2_BYTECODE_CACHE_ENABLE:
- cls = utils.load_class(JINJA2_BYTECODE_CACHE_BACKEND)
- env.bytecode_cache = cls(JINJA2_BYTECODE_CACHE_NAME)
-
-
-def match_template(template_name, regex=None, extension=None):
+def match_template(template_name, extension, regex):
if extension:
matches_extension = template_name.endswith(extension)
if regex:
@@ -246,105 +113,3 @@ def match_template(template_name, regex=None, extension=None):
return re.match(regex, template_name)
else:
return True
-
-
-def make_environment(defaults=None, clspath=None):
- """
- Create a new instance of jinja2 environment.
- """
-
- initial_params = {"autoescape": JINJA2_AUTOESCAPE}
- initial_params.update(JINJA2_ENVIRONMENT_OPTIONS)
-
- initial_params.setdefault("extensions", [])
- initial_params["extensions"].extend(JINJA2_EXTENSIONS)
-
- if JINJA2_UNDEFINED:
- if isinstance(JINJA2_UNDEFINED, six.string_types):
- initial_params["undefined"] = utils.load_class(JINJA2_UNDEFINED)
- else:
- initial_params["undefined"] = JINJA2_UNDEFINED
-
- if settings.DEBUG:
- initial_params.setdefault("undefined", jinja2.DebugUndefined)
- else:
- initial_params.setdefault("undefined", jinja2.Undefined)
-
- if defaults is not None:
- initial_params.update(defaults)
-
- if clspath is None:
- clspath = "jinja2.Environment"
-
- cls = utils.load_class(clspath)
- env = cls(**initial_params)
- env.template_class = Template
-
- return env
-
-
-if django.VERSION[:2] < (1, 8):
- def get_match_extension(using=None):
- """
- Gets the extension that the template loader will match for
- django-jinja. This returns the DEFAULT_JINJA2_TEMPLATE_EXTENSION
- setting.
-
- The "using" parameter is ignored for Django versions before 1.8.
- """
- return getattr(settings, 'DEFAULT_JINJA2_TEMPLATE_EXTENSION', '.jinja')
-else:
- def get_match_extension(using=None):
- """
- Gets the extension that the template loader will match for
- django-jinja. This returns Jinja2.match_extension.
-
- The "using" parameter selects with Jinja2 backend to use if
- you have multiple ones configured in settings.TEMPLATES.
- If it is None and only one Jinja2 backend is defined then it
- will use that, otherwise an ImproperlyConfigured exception
- is thrown.
- """
- from .backend import Jinja2
- from django.template import engines
-
- if using is None:
- engine = Jinja2.get_default()
- else:
- engine = engines[using]
-
- return engine.match_extension
-
-
-def initialize(environment):
- """
- Initialize given environment populating it with
- builtins and with django i18n data.
- """
- _initialize_builtins(environment)
- _initialize_thirdparty(environment)
- _initialize_i18n(environment)
- _initialize_bytecode_cache(environment)
- _initialize_template_loader(environment)
-
-
-def testing_reinitialize_signal(setting, **kwargs):
- if "JINJA" in setting or "TEMPLATE" in setting:
- global env
- env = make_environment()
- initialize(env)
-
-# Global variable for store the environment for django <= 1.7
-env = None
-
-def setup():
- global env
- env = make_environment()
-
- initialize(env)
- setting_changed.connect(testing_reinitialize_signal)
-
-# Fallback for prevous django versions.
-if django.VERSION[:2] < (1, 7):
- patch_django_for_autoescape()
- setup()
diff --git a/django_jinja/cache.py b/django_jinja/cache.py
index 79174f4..5223ce3 100644
--- a/django_jinja/cache.py
+++ b/django_jinja/cache.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-
-from django.core.cache import get_cache
+import django
from django.utils.functional import cached_property
from jinja2 import BytecodeCache as _BytecodeCache
@@ -15,7 +14,12 @@ class BytecodeCache(_BytecodeCache):
@cached_property
def backend(self):
- return get_cache(self._cache_name)
+ if django.VERSION[:2] < (1, 8):
+ from django.core.cache import get_cache
+ return get_cache(self._cache_name)
+ else:
+ from django.core.cache import caches
+ return caches[self._cache_name]
def load_bytecode(self, bucket):
key = 'jinja2_%s' % str(bucket.key)
diff --git a/django_jinja/library.py b/django_jinja/library.py
index 02b9a5f..5d2d25d 100644
--- a/django_jinja/library.py
+++ b/django_jinja/library.py
@@ -60,7 +60,8 @@ def _register_function(attr, name=None, fn=None):
def extension(extension):
global _local_env
- _local_env["extensions"].add(extensions)
+ _local_env["extensions"].add(extension)
+ return extension
def global_function(*args, **kwargs):
diff --git a/django_jinja/management/commands/makemessages.py b/django_jinja/management/commands/makemessages.py
index 0336a3a..70f0fd2 100644
--- a/django_jinja/management/commands/makemessages.py
+++ b/django_jinja/management/commands/makemessages.py
@@ -42,6 +42,8 @@ class Command(makemessages.Command):
def handle(self, *args, **options):
old_endblock_re = trans_real.endblock_re
old_block_re = trans_real.block_re
+ old_constant_re = trans_real.constant_re
+
old_templatize = trans_real.templatize
# Extend the regular expressions that are used to detect
# translation blocks with an "OR jinja-syntax" clause.
@@ -51,6 +53,7 @@ class Command(makemessages.Command):
trans_real.block_re.pattern + '|' + r"""^-?\s*trans(?:\s+(?!'|")(?=.*?=.*?)|\s*-?$)""")
trans_real.plural_re = re.compile(
trans_real.plural_re.pattern + '|' + r"""^-?\s*pluralize(?:\s+.+|-?$)""")
+ trans_real.constant_re = re.compile(r"""_\(((?:".*?")|(?:'.*?')).*\)""")
def my_templatize(src, origin=None):
new_src = strip_whitespaces(src)
@@ -64,3 +67,4 @@ class Command(makemessages.Command):
trans_real.endblock_re = old_endblock_re
trans_real.block_re = old_block_re
trans_real.templatize = old_templatize
+ trans_real.constant_re = old_constant_re
diff --git a/setup.py b/setup.py
index 979b42c..a519630 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ import sys
INSTALL_REQUIRES = [
"jinja2 >=2.5",
- "django >=1.4",
+ "django >=1.8",
]
if sys.version_info < (2, 7):
@@ -15,13 +15,13 @@ if sys.version_info < (2, 7):
setup(
name = "django-jinja",
- version = "1.4.1",
+ version = "2.1.1",
description = "Jinja2 templating language integrated in Django.",
long_description = "",
keywords = "django, jinja2",
author = "Andrey Antukh",
author_email = "niwi at niwi.be",
- url = "https://github.com/niwibe/django-jinja",
+ url = "https://github.com/niwinz/django-jinja",
license = "BSD",
packages = [
"django_jinja",
@@ -56,7 +56,6 @@ setup(
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Topic :: Internet :: WWW/HTTP",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-jinja.git
More information about the Python-modules-commits
mailing list