0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Refactor backend names to pillow and wand

This uses absolute_import and refactors the backend names to pillow &
wand. It changes tests to use these names and also modified the test
runner to not pass any parameters concerning the image backends since the
defaults are enough for tests. It also fixes a minor bug that was occured
when the image file had already been read (multiple renditions in a single
page)
This commit is contained in:
Serafeim Papastefanos 2014-03-12 14:41:26 +02:00
parent a72a67d50c
commit 4cc53eb4c9
5 changed files with 7 additions and 6 deletions

View File

@ -38,7 +38,7 @@ def get_image_backend(backend='default', **kwargs):
# Get configuration
default_conf = {
'default': {
'BACKEND': 'wagtail.wagtailimages.backends.pillow_backend.PillowBackend',
'BACKEND': 'wagtail.wagtailimages.backends.pillow.PillowBackend',
},
}
WAGTAILIMAGES_BACKENDS = getattr(

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django.db import models
from django.conf import settings
from base import BaseImageBackend
from .base import BaseImageBackend
from wand.image import Image

View File

@ -190,8 +190,7 @@ class Filter(models.Model):
self._parse_spec_string()
# If file is closed, open it
if input_file.closed:
input_file.open()
input_file.open('rb')
image = backend.open_image(input_file)
file_format = image.format

View File

@ -9,7 +9,7 @@ from wagtail.wagtailimages.models import get_image_model
from wagtail.wagtailimages.templatetags import image_tags
from wagtail.wagtailimages.backends import get_image_backend
from wagtail.wagtailimages.backends.pillow_backend import PillowBackend
from wagtail.wagtailimages.backends.pillow import PillowBackend
def get_test_image_file():
from StringIO import StringIO
@ -123,7 +123,7 @@ class TestRenditionsWand(TestCase):
title="Test image",
file=get_test_image_file(),
)
self.image.backend = 'wagtail.wagtailimages.backends.wand_backend.WandBackend'
self.image.backend = 'wagtail.wagtailimages.backends.wand.WandBackend'
def test_minification(self):
rendition = self.image.get_rendition('width-400')