Permalink
Browse files

- share now checks to make sure video has COMPLETE status

  • Loading branch information...
1 parent 6e8c3a6 commit cc303b77fe06151f594a9c6bfff69488ae303025 jbruce committed Feb 2, 2011
Showing with 11 additions and 4 deletions.
  1. +6 −2 pybrightcove/exceptions.py
  2. +5 −2 pybrightcove/video.py
@@ -241,8 +241,7 @@ class RemoteAssetsDisabledError(BrightcoveError):
class InvalidCountryCodeError(BrightcoveError):
- description = """The following country codes are not supported for
- geo-restriction:"""
+ description = """The following country codes are not supported for geo-restriction:"""
cause = "You used an invalid country code for geo-restriction."
code = 310
@@ -253,6 +252,10 @@ class GeoRestrictionDisabledError(BrightcoveError):
but your account is not enabled for this feature."""
code = 311
+class VideoStatusNotComplete(BrightcoveError):
+ description = "videos that do not have complete status cannot be shared"
+ cause = "video status is not complete"
+ code = 102
ERROR_MAP = {}
ERROR_MAP[100] = UnknownServerError
@@ -281,3 +284,4 @@ class GeoRestrictionDisabledError(BrightcoveError):
ERROR_MAP[309] = RemoteAssetsDisabledError
ERROR_MAP[310] = InvalidCountryCodeError
ERROR_MAP[311] = GeoRestrictionDisabledError
+ERROR_MAP[312] = VideoStatusNotComplete
View
@@ -580,8 +580,11 @@ def share(self, accounts):
msg = "Video.share expects an iterable argument"
raise exceptions.PyBrightcoveError(msg)
if len(accounts) > 0:
- return self.connection.post('share_video', video_id=self.id,
- auto_accept=True, sharee_account_ids=accounts)
+ if self.get_upload_status() == enums.UploadStatusEnum.COMPLETE:
+ return self.connection.post('share_video', video_id=self.id,
+ auto_accept=True, sharee_account_ids=accounts)
+ else:
+ raise VideoStatusNotComplete
def set_image(self, image, filename=None, resize=False):
"""

0 comments on commit cc303b7

Please sign in to comment.