diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ac7c21cd9..e6fc20d86 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -14,6 +14,7 @@ Changelog * page_published signal now called with the revision object that was published (Josh Barr) * Added an overrideable favicon to the admin interface * Added spinner animations to long-running form submissions + * The EMBEDLY_KEY setting has been renamed to WAGTAILEMBEDS_EMBEDLY_KEY (Anurag Sharma) * Fix: Deleting a page permission from the groups admin UI does not immediately submit the form * Fix: Wagtail userbar is shown on pages that do not pass a `page` variable to the template (e.g. because they override the `serve` method) * Fix: request.site now set correctly on page preview when the page is not in the default site diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index cf0722ea8..bb1dbb60f 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -66,6 +66,7 @@ Contributors * Michael Cordover * Timothy Allen * Rob Shelton +* Anurag Sharma Translators diff --git a/docs/advanced_topics/settings.rst b/docs/advanced_topics/settings.rst index 6cf61e98f..fc791483d 100644 --- a/docs/advanced_topics/settings.rst +++ b/docs/advanced_topics/settings.rst @@ -184,7 +184,7 @@ Use a custom embed finder function, which takes a URL and returns a dict with me .. code-block:: python # not a working key, get your own! - EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830' + WAGTAILEMBEDS_EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830' Providing an API key for the Embedly service will use that as a embed backend, with a more extensive list of providers, as well as analytics and other features. For more information, see `Embedly`_. @@ -515,7 +515,7 @@ These two files should reside in your project directory (``myproject/myproject/` # If you want to use Embedly for embeds, supply a key # (this key doesn't work, get your own!) - # EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830' + # WAGTAILEMBEDS_EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830' ``urls.py`` diff --git a/docs/releases/1.2.rst b/docs/releases/1.2.rst index 07b0a322b..c7a73db02 100644 --- a/docs/releases/1.2.rst +++ b/docs/releases/1.2.rst @@ -37,6 +37,7 @@ Minor features * page_published signal now called with the revision object that was published * Added a favicon to the admin interface, customisable by overriding the ``branding_favicon`` block (see :ref:`custom_branding`). * Added spinner animations to long-running form submissions + * The EMBEDLY_KEY setting has been renamed to WAGTAILEMBEDS_EMBEDLY_KEY Bug fixes ~~~~~~~~~ diff --git a/wagtail/wagtailembeds/embeds.py b/wagtail/wagtailembeds/embeds.py index 4b4f9d392..ccbd37c73 100644 --- a/wagtail/wagtailembeds/embeds.py +++ b/wagtail/wagtailembeds/embeds.py @@ -1,5 +1,6 @@ from datetime import datetime import json +import warnings # Needs to be imported like this to allow @patch to work in tests from django.utils.six.moves.urllib import request as urllib_request @@ -11,6 +12,7 @@ from django.conf import settings from wagtail.wagtailembeds.oembed_providers import get_oembed_provider from wagtail.wagtailembeds.models import Embed +from wagtail.utils.deprecation import RemovedInWagtail14Warning class EmbedException(Exception): @@ -31,7 +33,13 @@ def embedly(url, max_width=None, key=None): # Get embedly key if key is None: - key = settings.EMBEDLY_KEY + try: + key = settings.WAGTAILEMBEDS_EMBEDLY_KEY + except AttributeError: + key = settings.EMBEDLY_KEY + warnings.warn( + "EMBEDLY_KEY is now deprecated. Use WAGTAILEMBEDS_EMBEDLY_KEY instead", + RemovedInWagtail14Warning) # Get embedly client client = Embedly(key=key) @@ -115,7 +123,7 @@ def get_default_finder(): return import_string(settings.WAGTAILEMBEDS_EMBED_FINDER) # Use embedly if the embedly key is set - if hasattr(settings, 'EMBEDLY_KEY'): + if hasattr(settings, 'WAGTAILEMBEDS_EMBEDLY_KEY') or hasattr(settings, 'EMBEDLY_KEY'):: return embedly # Fall back to oembed