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
f0797813
Commit
f0797813
authored
Mar 25, 2014
by
Jason Bau
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3030 from edx/jrbl/fix_ncp101
certs: /request_cert: add_cert() strips HTML
parents
5388b654
eb24a226
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
lms/djangoapps/certificates/queue.py
+15
-6
No files found.
lms/djangoapps/certificates/queue.py
View file @
f0797813
...
...
@@ -15,6 +15,8 @@ from verify_student.models import SoftwareSecurePhotoVerification
import
json
import
random
import
logging
import
lxml
from
lxml.etree
import
XMLSyntaxError
,
ParserError
from
xmodule.modulestore
import
Location
...
...
@@ -205,8 +207,15 @@ class XQueueCertInterface(object):
cert
.
grade
=
grade
[
'percent'
]
cert
.
course_id
=
course_id
cert
.
name
=
profile_name
# Strip HTML from grade range label
grade_text
=
grade
.
get
(
'grade'
,
None
)
try
:
grade_text
=
lxml
.
html
.
fromstring
(
grade_text
)
.
text_content
()
except
(
TypeError
,
XMLSyntaxError
,
ParserError
)
as
e
:
# Despite blowing up the xml parser, bad values here are fine
grade_text
=
None
if
is_whitelisted
or
grade
[
'grade'
]
is
not
None
:
if
is_whitelisted
or
grade
_text
is
not
None
:
# check to see whether the student is on the
# the embargoed country restricted list
...
...
@@ -221,11 +230,11 @@ class XQueueCertInterface(object):
key
=
make_hashkey
(
random
.
random
())
cert
.
key
=
key
contents
=
{
'action'
:
'create'
,
'username'
:
student
.
username
,
'course_id'
:
course_id
,
'name'
:
profile_name
,
'grade'
:
grade
[
'grade'
]
,
'action'
:
'create'
,
'username'
:
student
.
username
,
'course_id'
:
course_id
,
'name'
:
profile_name
,
'grade'
:
grade_text
,
'template_pdf'
:
template_pdf
,
'designation'
:
profile_title
,
}
...
...
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