Skip to content

Commit

Permalink
Docs for get_backend method
Browse files Browse the repository at this point in the history
  • Loading branch information
yetty committed Mar 19, 2014
1 parent a1f5a39 commit c22c82a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions embed_video/templatetags/embed_video_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,17 @@ def __render_block(self, url, context):
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()

Expand Down

0 comments on commit c22c82a

Please sign in to comment.