Mercurial > public > sg101
diff oembed/views.py @ 1154:4da4e32b314c
Do not restrict oEmbed support to just video.
This will allow us to embed stuff from SoundClound and ReverbNation.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 27 Dec 2016 10:21:37 -0600 |
parents | 344f7914d421 |
children |
line wrap: on
line diff
--- a/oembed/views.py Tue Dec 27 09:31:08 2016 -0600 +++ b/oembed/views.py Tue Dec 27 10:21:37 2016 -0600 @@ -51,12 +51,13 @@ return HttpResponseBadRequest( "Sorry, we could not retrieve your video (%s)" % e) - if data.get('type') != 'video': + data_type = data.get('type', '?') + if data_type not in Oembed.ALLOWED_TYPES: return HttpResponseBadRequest( - "Hey, this doesn't look like a video..??") + "Hey, this doesn't look like a media type we support..??") oembed = Oembed(url=url, - type=Oembed.VIDEO, + type=Oembed.MEDIA_TYPE_REVERSE[data_type], title=data.get('title', ''), width=int(data.get('width', 0)), height=int(data.get('height', 0)),