Permalink
Browse files

Bump version and fix broken unit tests by using the processed filer s…

…ettings rather than the ones in django.conf.settings
  • Loading branch information...
1 parent a1537cc commit 6af79b6af25f82248ea051aa2304c65ce994b569 @kux kux committed Apr 24, 2013
Showing with 19 additions and 7 deletions.
  1. +2 −2 filertags/settings.py
  2. +10 −1 filertags/signals.py
  3. +2 −2 filertags/templatetags/filertags.py
  4. +4 −1 filertags/tests.py
  5. +1 −1 setup.py
View
@@ -1,6 +1,6 @@
-from django.conf import settings
+import filer.settings
-filer_storages = getattr(settings, 'FILER_STORAGES', {})
+filer_storages = getattr(filer.settings, 'FILER_STORAGES', {})
LOGICAL_EQ_ACTUAL_URL = all(
storage['main']['UPLOAD_TO'] == 'filer.utils.generate_filename.by_path'
View
@@ -250,8 +250,17 @@ def update_referencing_css_files(instance, **kwargs):
update_url_statements_in_css(css, resource_file, logical_file_path)
-if not LOGICAL_EQ_ACTUAL_URL:
+def attach_css_rewriting_rules():
signals.pre_save.connect(resolve_resource_urls, sender=File)
signals.post_save.connect(update_referencing_css_files, sender=File)
signals.post_save.connect(update_referencing_css_files, sender=Image)
+def detach_css_rewriting_rules():
+ signals.pre_save.disconnect(resolve_resource_urls, sender=File)
+ signals.post_save.disconnect(update_referencing_css_files, sender=File)
+ signals.post_save.disconnect(update_referencing_css_files, sender=Image)
+
+
+
+if not LOGICAL_EQ_ACTUAL_URL:
+ attach_css_rewriting_rules()
@@ -1,11 +1,11 @@
import logging
from django import template
-from django.conf import settings
from django.db.models import Q
from django.template.defaultfilters import stringfilter
from filer.models import File, Folder
+import filer.settings as filer_settings
# TODO: this is ugly: the ..settings is because the toplevel package
# name has the same name as this module; should probably rename the toplevel package?
from ..settings import LOGICAL_EQ_ACTUAL_URL
@@ -39,7 +39,7 @@ def filerthumbnail(path):
def get_possible_paths(path):
return ['%s/%s' % (storage['main']['UPLOAD_TO_PREFIX'], path)
- for storage in settings.FILER_STORAGES.values()]
+ for storage in filer_settings.FILER_STORAGES.values()]
def filerfile(path):
View
@@ -12,7 +12,8 @@
from filer.settings import FILER_PUBLICMEDIA_STORAGE
from filer.tests.helpers import create_superuser
-from filertags.signals import _ALREADY_PARSED_MARKER, _LOGICAL_URL_TEMPLATE
+from filertags.signals import _ALREADY_PARSED_MARKER, _LOGICAL_URL_TEMPLATE,\
+ attach_css_rewriting_rules, detach_css_rewriting_rules
class CssRewriteTest(TestCase):
@@ -22,6 +23,7 @@ def _get_test_usermedia_location(self):
return os.path.join(HERE, 'tmp_user_media')
def setUp(self):
+ attach_css_rewriting_rules()
self.superuser = create_superuser()
self.client.login(username='admin', password='secret')
media_folder = Folder.objects.create(name='media')
@@ -37,6 +39,7 @@ def tearDown(self):
cache.clear()
shutil.rmtree(FILER_PUBLICMEDIA_STORAGE.location)
FILER_PUBLICMEDIA_STORAGE.location = self.usual_location
+ detach_css_rewriting_rules()
def create_file(self, name, folder, content=None):
if content is None:
View
@@ -13,7 +13,7 @@
setup(
name='django-filer-tags',
- version='0.6.2',
+ version='0.6.3',
description='Extra template filters and tags for filer',
long_description = open(README_PATH, 'r').read(),
author='Sever Banesiu',

0 comments on commit 6af79b6

Please sign in to comment.