0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Made generate/verify signature importable from views.serve

... and deprecated wagtailimages/utils.py
This commit is contained in:
Karl Hobley 2015-11-08 17:56:39 +00:00
parent 47132306e5
commit 0049c0f310
5 changed files with 12 additions and 9 deletions

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -75,3 +75,5 @@ class ServeView(View):
serve = ServeView.as_view()
generate_signature = ServeView().generate_signature
verify_signature = ServeView().verify_signature