Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow the video_success_redirect to be a callable

it will be executed upon instantiation of the api object.
this is mostly useful when used in conjunction with the DjangoVzaar shim or a custom equivalent
  • Loading branch information...
commit 84a4800a0300631bd5a8e5f863a669a06c48b526 1 parent 0abafb7
@fourk authored
Showing with 6 additions and 3 deletions.
  1. +1 −1  setup.py
  2. +5 −2 vzaar.py
View
2  setup.py
@@ -10,5 +10,5 @@
author="James Burkhart",
author_email="pyvzaar@jamesburkhart.com",
url="https://github.com/fourk/vzaar",
- version='1.0.2',
+ version='1.0.3',
py_modules=['vzaar'])
View
7 vzaar.py
@@ -1,4 +1,4 @@
-__version__ = '1.0.2'
+__version__ = '1.0.3'
__author__ = "James Burkhart"
import oauth2 as oauth
@@ -13,7 +13,7 @@
vzaar_username - string - your username (not your email)
vzaar_key - string - Vzaar API key
video_success_redirect - string - where to redirect a user after upload
- ex: http://example.com/callback/
+ ex: http://example.com/callback/ (or a callable that returns a string)
max_video_size - integer - size (in bytes) of maximum alowed upload size
If you're using django, simply set a value for each of the above keys in
@@ -64,6 +64,8 @@ def __init__(self, vzaar_username, vzaar_key, video_success_redirect,
max_video_size):
self.VIDEO_SUCCESS_REDIRECT = video_success_redirect
+ if hasattr(self.VIDEO_SUCCESS_REDIRECT, '__call__'):
+ self.VIDEO_SUCCESS_REDIRECT = self.VIDEO_SUCCESS_REDIRECT()
self.MAX_VIDEO_SIZE = max_video_size
self.token = oauth.Token(key=vzaar_username,
secret=vzaar_key)
@@ -315,3 +317,4 @@ def __init__(self):
super(DjangoVzaar, self).__init__(settings.VZAAR_USERNAME,
settings.VZAAR_KEY, settings.VIDEO_SUCCESS_REDIRECT,
settings.MAX_VIDEO_SIZE)
+
Please sign in to comment.
Something went wrong with that request. Please try again.