Merge pull request #17406 from edx/yro/EDUCATOR-2230_code

Swap out exception class
This commit is contained in:
Gregory Martin
2018-02-07 15:14:35 -05:00
committed by GitHub

View File

@@ -506,11 +506,8 @@ def convert_video_status(video):
* `YouTube Duplicate` if status is `invalid_token`
* user-friendly video status
"""
try:
# Protect against legacy incomplete edx-val edx_video_id records.
now = datetime.now(video['created'].tzinfo)
except AttributeError:
now = datetime.now().replace(tzinfo=UTC)
now = datetime.now(video.get('created', datetime.now().replace(tzinfo=UTC)).tzinfo)
if video['status'] == 'upload' and (now - video['created']) > timedelta(hours=MAX_UPLOAD_HOURS):
new_status = 'upload_failed'
status = StatusDisplayStrings.get(new_status)