Commit b689d19b by Don Mitchell

Ensure empty video string deletes the video record and doesn't create

a partial descriptor. 
Use 400 not the contrived 515 for malformed html.
parent b5fd6c90
...@@ -986,7 +986,7 @@ def course_info_updates(request, org, course, provided_id=None): ...@@ -986,7 +986,7 @@ def course_info_updates(request, org, course, provided_id=None):
try: try:
return HttpResponse(json.dumps(update_course_updates(location, request.POST, provided_id)), mimetype="application/json") return HttpResponse(json.dumps(update_course_updates(location, request.POST, provided_id)), mimetype="application/json")
except etree.XMLSyntaxError: except etree.XMLSyntaxError:
return HttpResponse("Failed to save: malformed html", status=515, content_type="text/plain") return HttpResponseBadRequest("Failed to save: malformed html", content_type="text/plain")
@expect_json @expect_json
......
...@@ -163,8 +163,10 @@ class CourseDetails: ...@@ -163,8 +163,10 @@ class CourseDetails:
def recompose_video_tag(video_key): def recompose_video_tag(video_key):
# TODO should this use a mako template? Of course, my hope is that this is a short-term workaround for the db not storing # TODO should this use a mako template? Of course, my hope is that this is a short-term workaround for the db not storing
# the right thing # the right thing
result = '<iframe width="560" height="315" src="http://www.youtube.com/embed/' + \ result = None
video_key + '?autoplay=1&rel=0" frameborder="0" allowfullscreen=""></iframe>' if video_key:
result = '<iframe width="560" height="315" src="http://www.youtube.com/embed/' + \
video_key + '?autoplay=1&rel=0" frameborder="0" allowfullscreen=""></iframe>'
return result return result
......
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