Normalize settings.COMPRESS_ROOT in setting mangling instead in CSS default filter.

This commit is contained in:
Jannis Leidel
2011-05-13 12:25:59 +02:00
parent f9579a2c39
commit 068a7e24c4
2 changed files with 3 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ URL_PATTERN = re.compile(r'url\(([^\)]+)\)')
class CssAbsoluteFilter(FilterBase): class CssAbsoluteFilter(FilterBase):
def input(self, filename=None, basename=None, **kwargs): def input(self, filename=None, basename=None, **kwargs):
self.root = os.path.normcase(os.path.abspath(settings.COMPRESS_ROOT)) self.root = settings.COMPRESS_ROOT
if filename is not None: if filename is not None:
filename = os.path.normcase(os.path.abspath(filename)) filename = os.path.normcase(os.path.abspath(filename))
if (not (filename and filename.startswith(self.root)) and if (not (filename and filename.startswith(self.root)) and

View File

@@ -1,3 +1,4 @@
import os
from django import VERSION as DJANGO_VERSION from django import VERSION as DJANGO_VERSION
from django.conf import settings from django.conf import settings
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
@@ -66,7 +67,7 @@ class CompressorSettings(AppSettings):
if not value: if not value:
raise ImproperlyConfigured( raise ImproperlyConfigured(
"The COMPRESS_ROOT setting must be set.") "The COMPRESS_ROOT setting must be set.")
return value return os.path.normcase(os.path.abspath(value))
def configure_url(self, value): def configure_url(self, value):
# Uses Django 1.3's STATIC_URL by default or falls back to MEDIA_URL # Uses Django 1.3's STATIC_URL by default or falls back to MEDIA_URL