Commit 85a5ce9c by Balazs KOSSOVICS Committed by Timothée Peignier

django 1.2 compatibility

Signed-off-by: Timothée Peignier <timothee.peignier@tryphon.org>
parent bddd52d6
from django.contrib.staticfiles.finders import BaseStorageFinder
try:
from django.contrib.staticfiles.finders import BaseStorageFinder
except ImportError:
from staticfiles.finders import BaseStorageFinder
from pipeline.storage import PipelineStorage
......
import os
from django.core.cache import cache
from django.dispatch import Signal, receiver
from django.dispatch import Signal
from pipeline.conf import settings
......@@ -10,9 +10,10 @@ css_compressed = Signal(providing_args=["package", "version"])
js_compressed = Signal(providing_args=["package", "version"])
@receiver(css_compressed)
@receiver(js_compressed)
def invalidate_cache(sender, package, version, **kwargs):
filename_base, filename = os.path.split(package['output'])
cache.set("pipeline:%s" % filename, str(version),
settings.PIPELINE_CACHE_TIMEOUT)
js_compressed.connect(invalidate_cache)
css_compressed.connect(invalidate_cache)
......@@ -3,7 +3,11 @@ import os
from datetime import datetime
from django.contrib.staticfiles import finders
try:
from django.contrib.staticfiles import finders
except ImportError:
from staticfiles import finders
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import FileSystemStorage, get_storage_class
from django.utils.functional import LazyObject
......
......@@ -5,7 +5,10 @@ import sys
from mock import patch
from django.test import TestCase
from django.utils import unittest
try:
from django.utils import unittest
except ImportError:
import unittest2 as unittest
from pipeline.conf import settings
from pipeline.compressors import Compressor
......@@ -116,11 +119,10 @@ class CompressorTest(TestCase):
self.assertEquals(asset_path, "/images/sprite.png")
def test_url_rewrite(self):
self.maxDiff = None
output = self.compressor.concatenate_and_rewrite([
'css/urls.css',
])
self.assertMultiLineEqual("""@font-face {
self.assertEquals("""@font-face {
font-family: 'Pipeline';
src: url(http://localhost/static/fonts/pipeline.eot);
src: url(http://localhost/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');
......
......@@ -10,6 +10,8 @@ commands =
deps =
Django==1.3.1
mock>=0.7.2
django-staticfiles
unittest2
[testenv:docs]
changedir = docs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment