Moved get_default_finder into finders module

This commit is contained in:
Karl Hobley 2015-10-28 16:05:02 +00:00 committed by Matt Westcott
parent 40778b538d
commit 43b6545a5a
2 changed files with 19 additions and 19 deletions

View file

@ -1,25 +1,7 @@
from datetime import datetime
from django.utils.module_loading import import_string
from django.conf import settings
from wagtail.wagtailembeds.models import Embed
from wagtail.wagtailembeds.exceptions import EmbedException, EmbedNotFoundException # noqa
from wagtail.wagtailembeds.finders.oembed import oembed
from wagtail.wagtailembeds.finders.embedly import embedly
def get_default_finder():
# Check if the user has set the embed finder manually
if hasattr(settings, 'WAGTAILEMBEDS_EMBED_FINDER'):
return import_string(settings.WAGTAILEMBEDS_EMBED_FINDER)
# Use embedly if the embedly key is set
if hasattr(settings, 'WAGTAILEMBEDS_EMBEDLY_KEY'):
return embedly
# Fall back to oembed
return oembed
from wagtail.wagtailembeds.finders import get_default_finder
def get_embed(url, max_width=None, finder=None):

View file

@ -0,0 +1,18 @@
from django.utils.module_loading import import_string
from django.conf import settings
from wagtail.wagtailembeds.finders.oembed import oembed
from wagtail.wagtailembeds.finders.embedly import embedly
def get_default_finder():
# Check if the user has set the embed finder manually
if hasattr(settings, 'WAGTAILEMBEDS_EMBED_FINDER'):
return import_string(settings.WAGTAILEMBEDS_EMBED_FINDER)
# Use embedly if the embedly key is set
if hasattr(settings, 'WAGTAILEMBEDS_EMBEDLY_KEY'):
return embedly
# Fall back to oembed
return oembed