diff --git a/wagtail/wagtailimages/tests/test_admin_views.py b/wagtail/wagtailimages/tests/test_admin_views.py index 0dcdb09f4f..a659f6b4a7 100644 --- a/wagtail/wagtailimages/tests/test_admin_views.py +++ b/wagtail/wagtailimages/tests/test_admin_views.py @@ -12,7 +12,7 @@ from django.utils.http import urlquote from wagtail.tests.utils import WagtailTestUtils from wagtail.wagtailcore.models import Collection, GroupCollectionPermission -from wagtail.wagtailimages.utils import generate_signature +from wagtail.wagtailimages.views.serve import generate_signature from .utils import Image, get_test_image_file @@ -25,8 +25,6 @@ except ImportError: # < Django 1,8 urlquote_safechars = '/' - - class TestImageIndexView(TestCase, WagtailTestUtils): def setUp(self): self.login() diff --git a/wagtail/wagtailimages/tests/tests.py b/wagtail/wagtailimages/tests/tests.py index 344e3f551f..f9f24d1d21 100644 --- a/wagtail/wagtailimages/tests/tests.py +++ b/wagtail/wagtailimages/tests/tests.py @@ -17,8 +17,7 @@ from wagtail.wagtailimages.formats import Format, get_image_format, register_ima from wagtail.wagtailimages.forms import get_image_form from wagtail.wagtailimages.models import Image as WagtailImage from wagtail.wagtailimages.rect import Rect, Vector -from wagtail.wagtailimages.utils import generate_signature, verify_signature -from wagtail.wagtailimages.views.serve import ServeView +from wagtail.wagtailimages.views.serve import ServeView, generate_signature, verify_signature from .utils import Image, get_test_image_file diff --git a/wagtail/wagtailimages/utils.py b/wagtail/wagtailimages/utils.py index c6ea2d0968..c94b783c63 100644 --- a/wagtail/wagtailimages/utils.py +++ b/wagtail/wagtailimages/utils.py @@ -1,7 +1,11 @@ from __future__ import absolute_import, unicode_literals -from wagtail.wagtailimages.views.serve import ServeView +import warnings +from wagtail.utils.deprecation import RemovedInWagtail15Warning +from wagtail.wagtailimages.views.serve import generate_signature, verify_signature # noqa -generate_signature = ServeView().generate_signature -verify_signature = ServeView().verify_signature +warnings.warn( + "The 'generate_signature' and 'verify_signature' functions have been moved. " + "Please import them from the 'wagtail.wagtailimages.views.serve' module instead.", + RemovedInWagtail15Warning) diff --git a/wagtail/wagtailimages/views/images.py b/wagtail/wagtailimages/views/images.py index 1de154e501..c5f5ba051b 100644 --- a/wagtail/wagtailimages/views/images.py +++ b/wagtail/wagtailimages/views/images.py @@ -17,7 +17,7 @@ from wagtail.wagtailimages.exceptions import InvalidFilterSpecError from wagtail.wagtailimages.forms import URLGeneratorForm, get_image_form from wagtail.wagtailimages.models import Filter, get_image_model from wagtail.wagtailimages.permissions import permission_policy -from wagtail.wagtailimages.utils import generate_signature +from wagtail.wagtailimages.views.serve import generate_signature from wagtail.wagtailsearch.backends import get_search_backends permission_checker = PermissionPolicyChecker(permission_policy) diff --git a/wagtail/wagtailimages/views/serve.py b/wagtail/wagtailimages/views/serve.py index 35f012b86b..50bb22711e 100644 --- a/wagtail/wagtailimages/views/serve.py +++ b/wagtail/wagtailimages/views/serve.py @@ -75,3 +75,5 @@ class ServeView(View): serve = ServeView.as_view() +generate_signature = ServeView().generate_signature +verify_signature = ServeView().verify_signature