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
d942891b
Commit
d942891b
authored
Aug 12, 2015
by
Marko Jevtic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(SOL-1040) Indexing capa problems
parent
1ba82819
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
common/lib/xmodule/xmodule/capa_module.py
+21
-9
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
d942891b
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
json
import
json
import
logging
import
logging
import
sys
import
sys
import
re
from
lxml
import
etree
from
lxml
import
etree
from
pkg_resources
import
resource_string
from
pkg_resources
import
resource_string
...
@@ -10,6 +11,7 @@ import dogstats_wrapper as dog_stats_api
...
@@ -10,6 +11,7 @@ import dogstats_wrapper as dog_stats_api
from
.capa_base
import
CapaMixin
,
CapaFields
,
ComplexEncoder
from
.capa_base
import
CapaMixin
,
CapaFields
,
ComplexEncoder
from
capa
import
responsetypes
from
capa
import
responsetypes
from
.progress
import
Progress
from
.progress
import
Progress
from
xmodule.annotator_mixin
import
html_to_text
from
xmodule.x_module
import
XModule
,
module_attr
,
DEPRECATION_VSCOMPAT_EVENT
from
xmodule.x_module
import
XModule
,
module_attr
,
DEPRECATION_VSCOMPAT_EVENT
from
xmodule.raw_module
import
RawDescriptor
from
xmodule.raw_module
import
RawDescriptor
from
xmodule.exceptions
import
NotFoundError
,
ProcessingError
from
xmodule.exceptions
import
NotFoundError
,
ProcessingError
...
@@ -193,16 +195,26 @@ class CapaDescriptor(CapaFields, RawDescriptor):
...
@@ -193,16 +195,26 @@ class CapaDescriptor(CapaFields, RawDescriptor):
"""
"""
Return dictionary prepared with module content and type for indexing.
Return dictionary prepared with module content and type for indexing.
"""
"""
result
=
super
(
CapaDescriptor
,
self
)
.
index_dictionary
()
xblock_body
=
super
(
CapaDescriptor
,
self
)
.
index_dictionary
()
if
not
result
:
# Removing solution
result
=
{}
capa_content
=
re
.
sub
(
re
.
compile
(
r"<solution>.*</solution>"
,
re
.
DOTALL
),
""
,
self
.
data
)
index
=
{
# Removing HTML-encoded non-breaking space characters
'content_type'
:
self
.
INDEX_CONTENT_TYPE
,
capa_content
=
re
.
sub
(
r"(\s| |//)+"
,
" "
,
html_to_text
(
capa_content
))
'problem_types'
:
list
(
self
.
problem_types
),
# Removing HTML CDATA
"display_name"
:
self
.
display_name
capa_content
=
re
.
sub
(
r"<!\[CDATA\[.*\]\]>"
,
""
,
capa_content
)
# Removing HTML comments
capa_content
=
re
.
sub
(
r"<!--.*-->"
,
""
,
capa_content
)
capa_body
=
{
"capa_content"
:
capa_content
,
"display_name"
:
self
.
display_name
,
}
}
result
.
update
(
index
)
if
"content"
in
xblock_body
:
return
result
xblock_body
[
"content"
]
.
update
(
capa_body
)
else
:
xblock_body
[
"content"
]
=
capa_body
xblock_body
[
"content_type"
]
=
self
.
INDEX_CONTENT_TYPE
xblock_body
[
"problem_types"
]
=
list
(
self
.
problem_types
)
return
xblock_body
def
has_support
(
self
,
view
,
functionality
):
def
has_support
(
self
,
view
,
functionality
):
"""
"""
...
...
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