Docs for get_backend method

This commit is contained in:
Juda Kaleta 2014-03-19 22:50:00 +01:00
parent a1f5a392d5
commit c22c82a86a

View file

@ -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()