Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
4614687e
Commit
4614687e
authored
Feb 05, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug image submissions
parent
8bf29c0e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
common/lib/xmodule/xmodule/open_ended_image_submission.py
+6
-2
common/lib/xmodule/xmodule/openendedchild.py
+4
-2
No files found.
common/lib/xmodule/xmodule/open_ended_image_submission.py
View file @
4614687e
...
@@ -128,13 +128,15 @@ class ImageProperties(object):
...
@@ -128,13 +128,15 @@ class ImageProperties(object):
image_is_okay
=
False
image_is_okay
=
False
try
:
try
:
#image_is_okay = self.count_colors() and self.get_skin_ratio() and not self.image_too_large
#image_is_okay = self.count_colors() and self.get_skin_ratio() and not self.image_too_large
image_is_okay
=
self
.
image_too_large
image_is_okay
=
not
self
.
image_too_large
except
:
except
:
log
.
exception
(
"Could not run image tests."
)
log
.
exception
(
"Could not run image tests."
)
if
not
ENABLE_PIL
:
if
not
ENABLE_PIL
:
image_is_okay
=
True
image_is_okay
=
True
#log.debug("Image OK: {0}".format(image_is_okay))
return
image_is_okay
return
image_is_okay
...
@@ -252,7 +254,9 @@ def upload_to_s3(file_to_upload, keyname):
...
@@ -252,7 +254,9 @@ def upload_to_s3(file_to_upload, keyname):
return
True
,
public_url
return
True
,
public_url
except
:
except
:
return
False
,
"Could not connect to S3."
error_message
=
"Could not connect to S3."
log
.
exception
(
error_message
)
return
False
,
error_message
def
get_from_s3
(
s3_public_url
):
def
get_from_s3
(
s3_public_url
):
...
...
common/lib/xmodule/xmodule/openendedchild.py
View file @
4614687e
...
@@ -316,7 +316,7 @@ class OpenEndedChild(object):
...
@@ -316,7 +316,7 @@ class OpenEndedChild(object):
image_tag
=
""
image_tag
=
""
image_ok
=
False
image_ok
=
False
if
'can_upload_files'
in
get_data
:
if
'can_upload_files'
in
get_data
:
if
get_data
[
'can_upload_files'
]
==
'true'
:
if
get_data
[
'can_upload_files'
]
in
[
'true'
,
'1'
]
:
has_file_to_upload
=
True
has_file_to_upload
=
True
file
=
get_data
[
'student_file'
][
0
]
file
=
get_data
[
'student_file'
][
0
]
uploaded_to_s3
,
image_ok
,
s3_public_url
=
self
.
upload_image_to_s3
(
file
)
uploaded_to_s3
,
image_ok
,
s3_public_url
=
self
.
upload_image_to_s3
(
file
)
...
@@ -355,7 +355,7 @@ class OpenEndedChild(object):
...
@@ -355,7 +355,7 @@ class OpenEndedChild(object):
elif
has_file_to_upload
and
not
uploaded_to_s3
and
image_ok
:
elif
has_file_to_upload
and
not
uploaded_to_s3
and
image_ok
:
#In this case, an image was submitted by the student, but the image could not be uploaded to S3. Likely
#In this case, an image was submitted by the student, but the image could not be uploaded to S3. Likely
#a config issue (development vs deployment). For now, just treat this as a "success"
#a config issue (development vs deployment). For now, just treat this as a "success"
log
.
warning
(
"Student AJAX post to combined open ended xmodule indicated that it contained an image, "
log
.
exception
(
"Student AJAX post to combined open ended xmodule indicated that it contained an image, "
"but the image was not able to be uploaded to S3. This could indicate a config"
"but the image was not able to be uploaded to S3. This could indicate a config"
"issue with this deployment, but it could also indicate a problem with S3 or with the"
"issue with this deployment, but it could also indicate a problem with S3 or with the"
"student image itself."
)
"student image itself."
)
...
@@ -365,6 +365,8 @@ class OpenEndedChild(object):
...
@@ -365,6 +365,8 @@ class OpenEndedChild(object):
success
,
get_data
[
'student_answer'
]
=
self
.
check_for_url_in_text
(
get_data
[
'student_answer'
])
success
,
get_data
[
'student_answer'
]
=
self
.
check_for_url_in_text
(
get_data
[
'student_answer'
])
overall_success
=
success
overall_success
=
success
#log.debug("Has file: {0} Uploaded: {1} Image Ok: {2}".format(has_file_to_upload, uploaded_to_s3, image_ok))
return
overall_success
,
get_data
return
overall_success
,
get_data
def
check_for_url_in_text
(
self
,
string
):
def
check_for_url_in_text
(
self
,
string
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment