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
bbf37ef9
Commit
bbf37ef9
authored
Feb 06, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1446 from MITx/fix/vik/peer-grading-images
Fix/vik/peer grading images
parents
c68b0d3c
463f3161
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
common/lib/xmodule/xmodule/open_ended_image_submission.py
+11
-3
common/lib/xmodule/xmodule/openendedchild.py
+4
-2
No files found.
common/lib/xmodule/xmodule/open_ended_image_submission.py
View file @
bbf37ef9
...
...
@@ -40,7 +40,7 @@ ALLOWABLE_IMAGE_SUFFIXES = [
]
#Maximum allowed dimensions (x and y) for an uploaded image
MAX_ALLOWED_IMAGE_DIM
=
1
0
00
MAX_ALLOWED_IMAGE_DIM
=
1
5
00
#Dimensions to which image is resized before it is evaluated for color count, etc
MAX_IMAGE_DIM
=
150
...
...
@@ -128,10 +128,16 @@ class ImageProperties(object):
"""
image_is_okay
=
False
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
=
not
self
.
image_too_large
except
:
log
.
exception
(
"Could not run image tests."
)
if
not
ENABLE_PIL
:
image_is_okay
=
True
#log.debug("Image OK: {0}".format(image_is_okay))
return
image_is_okay
...
...
@@ -250,7 +256,9 @@ def upload_to_s3(file_to_upload, keyname):
return
True
,
public_url
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
):
...
...
common/lib/xmodule/xmodule/openendedchild.py
View file @
bbf37ef9
...
...
@@ -339,7 +339,7 @@ class OpenEndedChild(object):
image_tag
=
""
image_ok
=
False
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
file
=
get_data
[
'student_file'
][
0
]
uploaded_to_s3
,
image_ok
,
s3_public_url
=
self
.
upload_image_to_s3
(
file
)
...
...
@@ -378,7 +378,7 @@ class OpenEndedChild(object):
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
#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"
"issue with this deployment, but it could also indicate a problem with S3 or with the"
"student image itself."
)
...
...
@@ -388,6 +388,8 @@ class OpenEndedChild(object):
success
,
get_data
[
'student_answer'
]
=
self
.
check_for_url_in_text
(
get_data
[
'student_answer'
])
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
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