Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
RecommenderXBlock
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
RecommenderXBlock
Commits
a606d00b
Commit
a606d00b
authored
Jan 23, 2015
by
swdanielli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code quality check
parent
eccb7073
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
recommender/recommender.py
+4
-4
No files found.
recommender/recommender.py
View file @
a606d00b
...
@@ -332,7 +332,7 @@ class RecommenderXBlock(HelperXBlock):
...
@@ -332,7 +332,7 @@ class RecommenderXBlock(HelperXBlock):
"""
"""
Check the type and size of uploaded file. If the file type is
Check the type and size of uploaded file. If the file type is
unexpected or the size exceeds the threshold, log the error and return
unexpected or the size exceeds the threshold, log the error and return
to browser, otherwise, return None.
to browser, otherwise, return None.
"""
"""
# Check invalid file types
# Check invalid file types
file_type_error
=
False
file_type_error
=
False
...
@@ -498,7 +498,7 @@ class RecommenderXBlock(HelperXBlock):
...
@@ -498,7 +498,7 @@ class RecommenderXBlock(HelperXBlock):
response: HTTP response
response: HTTP response
response.body (response.responseText): name of the uploaded file
response.body (response.responseText): name of the uploaded file
We validate that this is a valid JPG, GIF, or PNG by checking magic number, mimetype,
We validate that this is a valid JPG, GIF, or PNG by checking magic number, mimetype,
and extension all correspond. We also limit to 30MB. We save the file under its MD5
and extension all correspond. We also limit to 30MB. We save the file under its MD5
hash to (1) avoid name conflicts, (2) avoid race conditions and (3) save space.
hash to (1) avoid name conflicts, (2) avoid race conditions and (3) save space.
"""
"""
...
@@ -602,7 +602,7 @@ class RecommenderXBlock(HelperXBlock):
...
@@ -602,7 +602,7 @@ class RecommenderXBlock(HelperXBlock):
for
field
in
self
.
resource_content_fields
:
for
field
in
self
.
resource_content_fields
:
result
[
'old_'
+
field
]
=
self
.
recommendations
[
resource_id
][
field
]
result
[
'old_'
+
field
]
=
self
.
recommendations
[
resource_id
][
field
]
# If the content in resource is unchanged (i.e., data[field] is
# If the content in resource is unchanged (i.e., data[field] is
# empty), return and log the content stored in the database
# empty), return and log the content stored in the database
# (self.recommendations), otherwise, return and log the edited
# (self.recommendations), otherwise, return and log the edited
# one (data[field])
# one (data[field])
if
data
[
field
]
==
""
:
if
data
[
field
]
==
""
:
...
@@ -885,7 +885,7 @@ class RecommenderXBlock(HelperXBlock):
...
@@ -885,7 +885,7 @@ class RecommenderXBlock(HelperXBlock):
# no endorsed_recommendation_reasons. Thus, we add empty reasons to
# no endorsed_recommendation_reasons. Thus, we add empty reasons to
# make the length of the two lists equal
# make the length of the two lists equal
#
#
# TODO: Go through old lists of resources in course, and remove this
# TODO: Go through old lists of resources in course, and remove this
# code. The migration should be done.
# code. The migration should be done.
while
len
(
self
.
endorsed_recommendation_ids
)
>
len
(
self
.
endorsed_recommendation_reasons
):
while
len
(
self
.
endorsed_recommendation_ids
)
>
len
(
self
.
endorsed_recommendation_reasons
):
self
.
endorsed_recommendation_reasons
.
append
(
''
)
self
.
endorsed_recommendation_reasons
.
append
(
''
)
...
...
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