Fix some image upload issues

This commit is contained in:
Vik Paruchuri
2013-01-30 11:11:23 -05:00
parent d6947f1da7
commit 6c21469bed
4 changed files with 5 additions and 2 deletions

View File

@@ -187,6 +187,8 @@ class @CombinedOpenEnded
if files.size > max_filesize
@can_upload_files = false
files = ""
else
@can_upload_files = false
fd = new FormData()
fd.append('student_answer', @answer_area.val())

View File

@@ -554,8 +554,8 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
# add new history element with answer and empty score and hint.
get = self.append_image_to_student_answer(get)
self.new_history_entry(get['student_answer'])
get['student_answer'] = OpenEndedModule.sanitize_html(get['student_answer'])
self.new_history_entry(get['student_answer'])
self.send_to_grader(get['student_answer'], system)
self.change_state(self.ASSESSING)

View File

@@ -285,8 +285,8 @@ class OpenEndedChild(object):
"""
success = False
s3_public_url = ""
image_data.seek(0)
try:
image_data.seek(0)
image = Image.open(image_data)
image_ok = open_ended_image_submission.run_image_tests(image)
log.debug("Image ok: {0}".format(image_ok))

View File

@@ -204,6 +204,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
# add new history element with answer and empty score and hint.
get = self.append_image_to_student_answer(get)
get['student_answer'] = SelfAssessmentModule.sanitize_html(get['student_answer'])
self.new_history_entry(get['student_answer'])
self.change_state(self.ASSESSING)