mirror of
https://github.com/Hopiu/django-embed-video.git
synced 2026-04-29 00:44:43 +00:00
Closes #18.
This commit is contained in:
parent
0850b2385c
commit
84b2df8d4e
3 changed files with 15 additions and 0 deletions
|
|
@ -3,6 +3,8 @@ Release 0.8 (dev)
|
|||
|
||||
- Add ``EMBED_VIDEO_TIMEOUT`` to settings.
|
||||
|
||||
- Fix renderering template tag if no url is provided (`#18 <https://github.com/yetty/django-embed-video/issues/18>`_)
|
||||
|
||||
|
||||
Release 0.7 (Dec. 21, 2013)
|
||||
---------------------------
|
||||
|
|
|
|||
|
|
@ -67,6 +67,11 @@ class VideoNode(Node):
|
|||
def render(self, context):
|
||||
url = self.url.resolve(context)
|
||||
|
||||
# Fixes #18. If no video url is provided it should return an empty
|
||||
# string instead raising UnknownBackendException.
|
||||
if not url:
|
||||
return ''
|
||||
|
||||
if self.size:
|
||||
return self.__render_embed(url, context)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -153,3 +153,11 @@ class EmbedVideoNodeTestCase(TestCase):
|
|||
backend = VideoNode.get_backend('http://www.youtube.com/watch?v=jsrRJyHBvzw', context)
|
||||
self.assertFalse(backend.is_secure)
|
||||
|
||||
def test_no_video_provided(self):
|
||||
template = Template("""
|
||||
{% load embed_video_tags %}
|
||||
{% video '' 'large' %}
|
||||
""")
|
||||
self.assertEqual(template.render(self._grc()).strip(), '')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue