v. 0.2.4: 0.2.4
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Thu, 16 Apr 2015 13:17:07 +0000 (15:17 +0200)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Thu, 16 Apr 2015 13:17:07 +0000 (15:17 +0200)
* Django 1.8 compatibility.
* Remove private headers from response.
* Python-3 compatible get_version.

CHANGELOG.md
README.md
setup.cfg [new file with mode: 0644]
setup.py
ssify/__init__.py
ssify/middleware.py
ssify/variables.py
ssify/version.py
tox.ini

index d87720c..208ec31 100644 (file)
@@ -1,5 +1,14 @@
 # Changelog
 
 # Changelog
 
+## 0.2.4 (2015-04-16)
+
+* Django 1.8 compatibility.
+
+* Remove private headers from response.
+
+* Python-3 compatible get_version.
+
+
 ## 0.2.3 (2014-09-22)
 
 * Don't assume request object we are passed at any point still has
 ## 0.2.3 (2014-09-22)
 
 * Don't assume request object we are passed at any point still has
index 042d91d..8a8aefd 100644 (file)
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@ License
 
   ![AGPL Logo](http://www.gnu.org/graphics/agplv3-155x51.png)
     
 
   ![AGPL Logo](http://www.gnu.org/graphics/agplv3-155x51.png)
     
-    Copyright © 2014 Fundacja Nowoczesna Polska <fundacja@nowoczesnapolska.org.pl>
+    Copyright © 2014,2015 Fundacja Nowoczesna Polska <fundacja@nowoczesnapolska.org.pl>
     
     For full list of contributors see AUTHORS section at the end. 
 
     
     For full list of contributors see AUTHORS section at the end. 
 
diff --git a/setup.cfg b/setup.cfg
new file mode 100644 (file)
index 0000000..11d9c44
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,3 @@
+[bdist_wheel]
+universal=1
+
index 6228c5c..dc7946d 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -10,9 +10,9 @@ from setuptools import setup, find_packages
 def get_version():
     basedir = os.path.dirname(__file__)
     with open(os.path.join(basedir, 'ssify/version.py')) as f:
 def get_version():
     basedir = os.path.dirname(__file__)
     with open(os.path.join(basedir, 'ssify/version.py')) as f:
-        VERSION = None
-        exec(f.read())
-        return VERSION
+        variables = {}
+        exec(f.read(), variables)
+        return variables.get('VERSION')
     raise RuntimeError('No version info found.')
 
 
     raise RuntimeError('No version info found.')
 
 
index 74c1108..34c7040 100644 (file)
@@ -17,7 +17,6 @@ from __future__ import unicode_literals
 from .version import VERSION
 
 __version__ = VERSION
 from .version import VERSION
 
 __version__ = VERSION
-__date__ = '2014-08-26'
 __all__ = ('flush_ssi_includes', 'ssi_expect', 'SsiVariable', 'ssi_included', 'ssi_variable')
 
 from .variables import ssi_expect, SsiVariable
 __all__ = ('flush_ssi_includes', 'ssi_expect', 'SsiVariable', 'ssi_included', 'ssi_variable')
 
 from .variables import ssi_expect, SsiVariable
index fc57eb0..419a074 100644 (file)
@@ -121,10 +121,14 @@ class SsiMiddleware(object):
         # Prepend the SSI variables.
         if hasattr(request, 'ssi_vars_needed'):
             vars_needed = request.ssi_vars_needed
         # Prepend the SSI variables.
         if hasattr(request, 'ssi_vars_needed'):
             vars_needed = request.ssi_vars_needed
-        else:
-            vars_needed = json_decode(response.get('X-Ssi-Vars-Needed', '{}'))
+        elif 'X-Ssi-Vars-Needed' in response:
+            vars_needed = json_decode(response['X-Ssi-Vars-Needed'])
             for k, v in vars_needed.items():
                 vars_needed[k] = SsiVariable(*v)
             for k, v in vars_needed.items():
                 vars_needed[k] = SsiVariable(*v)
+            if not settings.DEBUG:
+                del response['X-Ssi-Vars-Needed']
+        else:
+            vars_needed = None
 
         if vars_needed:
             response.content = provide_vars(request, vars_needed) + \
 
         if vars_needed:
             response.content = provide_vars(request, vars_needed) + \
@@ -139,6 +143,8 @@ class SsiMiddleware(object):
                     del response[header]
                 else:
                     response[header] = content
                     del response[header]
                 else:
                     response[header] = content
+            if not settings.DEBUG:
+                del response['X-ssi-restore']
         else:
             for response_modifier in getattr(request, 'ssi_patch_response', []):
                 response_modifier(response)
         else:
             for response_modifier in getattr(request, 'ssi_patch_response', []):
                 response_modifier(response)
index 46a787b..014e95f 100644 (file)
@@ -11,7 +11,8 @@ at request time to the prerendered templates.
 """
 from __future__ import unicode_literals
 from hashlib import md5
 """
 from __future__ import unicode_literals
 from hashlib import md5
-from django import template
+from django.template import Node
+from django.template.base import get_library
 from django.utils.encoding import force_text, python_2_unicode_compatible
 from django.utils.functional import Promise
 from django.utils.safestring import mark_safe
 from django.utils.encoding import force_text, python_2_unicode_compatible
 from django.utils.functional import Promise
 from django.utils.safestring import mark_safe
@@ -72,7 +73,7 @@ class SsiVariable(object):
     def get_value(self, request):
         """Computes the real value of the variable, using the request."""
         taglib, tagname = self.tagpath.rsplit('.', 1)
     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):
             request, *self.args, **self.kwargs)
 
     def __str__(self):
@@ -117,7 +118,7 @@ def ssi_expect(var, type_):
         return type_(var)
 
 
         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
     """ Node for the SsiVariable tags. """
     def __init__(self, tagpath, args, kwargs, patch_response=None, asvar=None):
         self.tagpath = tagpath
index 6d09f02..911848b 100644 (file)
@@ -1,3 +1,3 @@
 from __future__ import unicode_literals
 
 from __future__ import unicode_literals
 
-VERSION = '0.2.3'
\ No newline at end of file
+VERSION = '0.2.4'
\ No newline at end of file
diff --git a/tox.ini b/tox.ini
index 0daa6e6..8aa3898 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,8 @@
 [tox]
 envlist=clear,
     d1{5,6}-py{26,27,32,33},
 [tox]
 envlist=clear,
     d1{5,6}-py{26,27,32,33},
-    d{17,d}-py{27,32,33,34},
+    d{17,18}-py{27,32,33,34},
+    d{d}-py{27,33,34},
     stats
 
 [testenv]
     stats
 
 [testenv]
@@ -14,7 +15,8 @@ deps=
     d15: Django>=1.5,<1.6
     d16: Django>=1.6,<1.7
     d17: Django>=1.7,<1.8
     d15: Django>=1.5,<1.6
     d16: Django>=1.6,<1.7
     d17: Django>=1.7,<1.8
-    dd: https://github.com/django/django/zipball/master
+    d18: Django>=1.8,<1.9
+    dd: https://github.com/django/django/archive/master.tar.gz
     coverage
 basepython=
     py26: python2.6
     coverage
 basepython=
     py26: python2.6