[Python-modules-commits] [django-sekizai] 02/07: Import django-sekizai_0.10.0.orig.tar.gz
Michael Fladischer
fladi at moszumanska.debian.org
Thu Sep 1 08:24:46 UTC 2016
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch master
in repository django-sekizai.
commit f1884c0a682dc66825103cc36318d21429f401b8
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Thu Sep 1 10:07:53 2016 +0200
Import django-sekizai_0.10.0.orig.tar.gz
---
.travis.yml | 10 +++-------
README.rst | 2 +-
docs/index.rst | 20 ++++++++++++++------
runtests.py | 13 +++++++++++++
sekizai/__init__.py | 2 +-
sekizai/templatetags/sekizai_tags.py | 12 +++++++++++-
sekizai/tests.py | 29 ++++++++++++++++++++++++++++-
setup.py | 10 +---------
8 files changed, 72 insertions(+), 26 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index acd985d..9a51a85 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
language: python
sudo: false
python:
- - 2.6
- 2.7
- 3.3
- 3.4
@@ -14,6 +13,7 @@ env:
- DJANGO='django>=1.7,<1.8'
- DJANGO='django>=1.8,<1.9'
- DJANGO='django>=1.9,<1.10'
+ - DJANGO='django>=1.10,<1.11'
install:
- pip install $DJANGO django-classy-tags pep8 backport-collections
script: python runtests.py
@@ -21,18 +21,14 @@ notifications:
email: false
matrix:
exclude:
- - python: 2.6
- env: DJANGO='django>=1.7,<1.8'
- - python: 2.6
- env: DJANGO='django>=1.8,<1.9'
- - python: 2.6
- env: DJANGO='django>=1.9,<1.10'
- python: 3.3
env: DJANGO='django>=1.3,<1.4'
- python: 3.3
env: DJANGO='django>=1.4,<1.5'
- python: 3.3
env: DJANGO='django>=1.9,<1.10'
+ - python: 3.3
+ env: DJANGO='django>=1.10,<1.11'
- python: 3.4
env: DJANGO='django>=1.3,<1.4'
- python: 3.4
diff --git a/README.rst b/README.rst
index e351ba4..1f89fac 100644
--- a/README.rst
+++ b/README.rst
@@ -1,4 +1,4 @@
-Please refer to the documentation in the docs/ directory or on `RTFD <http://django-sekizai.readthedocs.org/en/latest/>`_ for help.
+Please refer to the documentation in the docs/ directory or on `RTFD <https://django-sekizai.readthedocs.io/en/latest/>`_ for help.
About this project:
diff --git a/docs/index.rst b/docs/index.rst
index a7e6779..431c5e2 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -31,13 +31,10 @@ sekizai will ignore any duplicate content in a single block.
Dependencies
************
-* Python 2.6, 2.7, 3.3, 3.4 or 3.5.
-* Django 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 or 1.9.
+* Python 2.7, 3.3, 3.4 or 3.5.
+* Django 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9 or 1.10.
* django-classy-tags 0.3.1 or higher.
-Python 2.6 requires ``backport_collections``.
-
-
*****
Usage
*****
@@ -50,9 +47,14 @@ steps:
* Put 'sekizai' into your ``INSTALLED_APPS`` setting.
* Use one of the following:
- * Put ``sekizai.context_processors.sekizai`` into your
+ * For Django versions before 1.10, add
+ ``sekizai.context_processors.sekizai`` to your
``TEMPLATE_CONTEXT_PROCESSORS`` setting and use
``django.template.RequestContext`` when rendering your templates.
+
+ For Django versions after 1.10, add ``sekizai.context_processors.sekizai``
+ to your ``TEMPLATES['OPTIONS']['context_processors']`` setting and use
+ ``django.template.RequestContext`` when rendering your templates.
or
@@ -428,6 +430,12 @@ And here's the rendered template::
Changelog
*********
+0.10.0
+======
+
+* Added support for Django 1.10
+* Removed support for Python 2.6
+
0.9.0
=====
diff --git a/runtests.py b/runtests.py
index cc3500e..dfd0d45 100644
--- a/runtests.py
+++ b/runtests.py
@@ -30,6 +30,18 @@ TEMPLATE_CONTEXT_PROCESSORS = [
ROOT_URLCONF = 'runtests'
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': TEMPLATE_DIRS,
+ 'OPTIONS': {
+ 'context_processors': TEMPLATE_CONTEXT_PROCESSORS,
+ 'debug': TEMPLATE_DEBUG
+ },
+ },
+]
+
+
def runtests():
from django import VERSION
from django.conf import settings
@@ -46,6 +58,7 @@ def runtests():
TEMPLATE_CONTEXT_PROCESSORS=TEMPLATE_CONTEXT_PROCESSORS,
TEMPLATE_DEBUG=TEMPLATE_DEBUG,
MIDDLEWARE_CLASSES=[],
+ TEMPLATES=TEMPLATES,
)
if VERSION[1] >= 7:
from django import setup
diff --git a/sekizai/__init__.py b/sekizai/__init__.py
index e4e49b3..9d1bb72 100644
--- a/sekizai/__init__.py
+++ b/sekizai/__init__.py
@@ -1 +1 @@
-__version__ = '0.9.0'
+__version__ = '0.10.0'
diff --git a/sekizai/templatetags/sekizai_tags.py b/sekizai/templatetags/sekizai_tags.py
index 1b4c86f..8ae5607 100644
--- a/sekizai/templatetags/sekizai_tags.py
+++ b/sekizai/templatetags/sekizai_tags.py
@@ -26,9 +26,19 @@ def validate_context(context):
Raises a TemplateSyntaxError if the context is invalid and we're in debug
mode.
"""
+ try:
+ template_debug = context.template.engine.debug
+ except AttributeError:
+ try:
+ # Get the default engine debug value
+ template_debug = template.Engine.get_default().debug
+ except AttributeError:
+ # Django 1.9 and below fallback
+ template_debug = settings.TEMPLATE_DEBUG
+
if get_varname() in context:
return True
- if not settings.TEMPLATE_DEBUG:
+ if not template_debug:
return False
raise template.TemplateSyntaxError(
"You must enable the 'sekizai.context_processors.sekizai' template "
diff --git a/sekizai/tests.py b/sekizai/tests.py
index db401b7..8e55f61 100644
--- a/sekizai/tests.py
+++ b/sekizai/tests.py
@@ -4,6 +4,7 @@ import os
from unittest import TestCase
import sys
+import django
from django import template
from django.conf import settings
from django.template.loader import render_to_string
@@ -163,6 +164,31 @@ class BitDiff(object):
return BitDiffResult(False, msg)
+def update_template_debug(debug=True):
+ """
+ Helper method for updating the template debug option based on
+ the django version. Use the results of this function as the context.
+
+ :return: SettingsOverride object
+ """
+ if django.VERSION[0] == 1 and django.VERSION[1] < 8:
+ return SettingsOverride(TEMPLATE_DEBUG=debug)
+ else:
+ # Create our overridden template settings with debug turned off.
+ templates_override = settings.TEMPLATES
+ templates_override[0]['OPTIONS'].update({
+ 'debug': debug
+ })
+
+ from django.template.engine import Engine
+ # Engine gets created based on template settings initial value so
+ # changing the settings after the fact won't update, so do it
+ # manually. Necessary when testing validate_context
+ # with render method and want debug off.
+ Engine.get_default().debug = debug
+ return SettingsOverride(TEMPLATES=templates_override)
+
+
class SekizaiTestCase(TestCase):
@classmethod
def setUpClass(cls):
@@ -352,7 +378,8 @@ class SekizaiTestCase(TestCase):
validate_context, django_ctx
)
self.assertEqual(validate_context(sekizai_ctx), True)
- with SettingsOverride(TEMPLATE_DEBUG=False):
+
+ with update_template_debug(debug=False):
self.assertEqual(validate_context(django_ctx), False)
self.assertEqual(validate_context(sekizai_ctx), True)
bits = ['some content', 'more content', 'final content']
diff --git a/setup.py b/setup.py
index 4928d11..2891107 100644
--- a/setup.py
+++ b/setup.py
@@ -1,15 +1,8 @@
-import sys
-
from setuptools import setup, find_packages
version = __import__('sekizai').__version__
-if sys.hexversion < 0x02070000:
- EXTRA_INSTALL_REQUIRES = ['backport_collections']
-else:
- EXTRA_INSTALL_REQUIRES = []
-
setup(
name='django-sekizai',
version=version,
@@ -22,7 +15,7 @@ setup(
include_package_data=True,
install_requires=[
'django-classy-tags>=0.3.1',
- ] + EXTRA_INSTALL_REQUIRES,
+ ],
test_suite='runtests.main',
classifiers=[
'Development Status :: 5 - Production/Stable',
@@ -32,7 +25,6 @@ setup(
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-sekizai.git
More information about the Python-modules-commits
mailing list