Commit 4894d064 by muhammad-ammar

address feedback

parent 6a85bc9b
...@@ -142,18 +142,16 @@ def update_video_status(edx_video_id, status): ...@@ -142,18 +142,16 @@ def update_video_status(edx_video_id, status):
video.save() video.save()
def get_course_video_image_url(course_id=None, edx_video_id=None, video_image=None): def get_course_video_image_url(course_id, edx_video_id):
""" """
Returns course video image url or None if no image found Returns course video image url or None if no image found
""" """
try: try:
if video_image is None: video_image = CourseVideo.objects.get(course_id=course_id, video__edx_video_id=edx_video_id).video_image
video_image = CourseVideo.objects.get(course_id=course_id, video__edx_video_id=edx_video_id).video_image return video_image.image_url()
except ObjectDoesNotExist: except ObjectDoesNotExist:
return None return None
return video_image.image_url()
def update_video_image(edx_video_id, course_id, image_data, file_name): def update_video_image(edx_video_id, course_id, image_data, file_name):
""" """
......
...@@ -147,12 +147,10 @@ class CourseVideo(models.Model, ModelFactoryWithValidation): ...@@ -147,12 +147,10 @@ class CourseVideo(models.Model, ModelFactoryWithValidation):
def image_url(self): def image_url(self):
""" """
Return image url for a course video image. Return image url for a course video image or None if no image.
""" """
try: if hasattr(self, 'video_image'):
return self.video_image.image_url() return self.video_image.image_url()
except VideoImage.DoesNotExist:
pass
def __unicode__(self): def __unicode__(self):
return self.course_id return self.course_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment