From c22c82a86a6c73453c00a9f0d35843b1f751cd4e Mon Sep 17 00:00:00 2001 From: Juda Kaleta Date: Wed, 19 Mar 2014 22:50:00 +0100 Subject: [PATCH] Docs for get_backend method --- embed_video/templatetags/embed_video_tags.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/embed_video/templatetags/embed_video_tags.py b/embed_video/templatetags/embed_video_tags.py index 5e4e86b..410078b 100644 --- a/embed_video/templatetags/embed_video_tags.py +++ b/embed_video/templatetags/embed_video_tags.py @@ -103,9 +103,17 @@ class VideoNode(Node): return output @staticmethod - def get_backend(backend, context=None): - if not isinstance(backend, VideoBackend): - backend = detect_backend(backend) + def get_backend(backend_or_url, context=None): + """ + Returns instance of VideoBackend. If context is passed to the method + and request is secure, than the is_secure mark is set to backend. + + A string or VideoBackend instance can be passed to the method. + """ + + backend = backend_or_url if isinstance(backend_or_url, VideoBackend) \ + else detect_backend(backend_or_url) + if context and 'request' in context: backend.is_secure = context['request'].is_secure()