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
ba280e2c
Commit
ba280e2c
authored
May 12, 2016
by
Syed Hassan Raza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detail Logging xmodule exceptions
parent
98f6785b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
0 deletions
+42
-0
common/lib/xmodule/xmodule/modulestore/tests/test_xml_importer.py
+17
-0
common/lib/xmodule/xmodule/tests/test_video.py
+8
-0
common/lib/xmodule/xmodule/video_module/video_module.py
+9
-0
common/lib/xmodule/xmodule/x_module.py
+8
-0
No files found.
common/lib/xmodule/xmodule/modulestore/tests/test_xml_importer.py
View file @
ba280e2c
...
@@ -230,6 +230,23 @@ class RemapNamespaceTest(ModuleStoreNoSettings):
...
@@ -230,6 +230,23 @@ class RemapNamespaceTest(ModuleStoreNoSettings):
'graded'
,
new_version
.
get_explicitly_set_fields_by_scope
(
scope
=
Scope
.
settings
)
'graded'
,
new_version
.
get_explicitly_set_fields_by_scope
(
scope
=
Scope
.
settings
)
)
)
def
test_xblock_invalid_field_value_type
(
self
):
# Setting the wrong field-value in Xblock-field will raise TypeError.
# Example if xblock-field is of 'Dictionary' type by setting the 'List' value in that dict-type will raise
# TypeError.
# Set the XBlock's location
self
.
xblock
.
location
=
Location
(
"org"
,
"import"
,
"run"
,
"category"
,
"stubxblock"
)
# Explicitly set the content field
self
.
xblock
.
test_content_field
=
[
'Explicitly set'
]
self
.
xblock
.
save
()
# clearing the dirty fields and removing value from cache will fetch the value from field-data.
self
.
xblock
.
_dirty_fields
=
{}
# pylint: disable=protected-access
self
.
xblock
.
fields
[
'test_content_field'
]
.
_del_cached_value
(
self
.
xblock
)
# pylint: disable=protected-access
with
self
.
assertRaises
(
TypeError
):
self
.
xblock
.
get_explicitly_set_fields_by_scope
(
scope
=
Scope
.
content
)
class
StubXBlockWithMutableFields
(
StubXBlock
):
class
StubXBlockWithMutableFields
(
StubXBlock
):
"""
"""
...
...
common/lib/xmodule/xmodule/tests/test_video.py
View file @
ba280e2c
...
@@ -750,6 +750,14 @@ class VideoExportTestCase(VideoDescriptorTestBase):
...
@@ -750,6 +750,14 @@ class VideoExportTestCase(VideoDescriptorTestBase):
expected
=
'<video url_name="SampleProblem" download_video="false"/>
\n
'
expected
=
'<video url_name="SampleProblem" download_video="false"/>
\n
'
self
.
assertEquals
(
expected
,
etree
.
tostring
(
xml
,
pretty_print
=
True
))
self
.
assertEquals
(
expected
,
etree
.
tostring
(
xml
,
pretty_print
=
True
))
def
test_export_to_xml_invalid_characters_in_attributes
(
self
):
"""
Test XML export will raise TypeError by lxml library if contains illegal characters.
"""
self
.
descriptor
.
display_name
=
'
\x1e
'
with
self
.
assertRaises
(
ValueError
):
self
.
descriptor
.
definition_to_xml
(
None
)
class
VideoDescriptorIndexingTestCase
(
unittest
.
TestCase
):
class
VideoDescriptorIndexingTestCase
(
unittest
.
TestCase
):
"""
"""
...
...
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
ba280e2c
...
@@ -561,7 +561,16 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
...
@@ -561,7 +561,16 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
# is set to its default value, we don't write it out.
# is set to its default value, we don't write it out.
if
value
:
if
value
:
if
key
in
self
.
fields
and
self
.
fields
[
key
]
.
is_set_on
(
self
):
if
key
in
self
.
fields
and
self
.
fields
[
key
]
.
is_set_on
(
self
):
try
:
xml
.
set
(
key
,
unicode
(
value
))
xml
.
set
(
key
,
unicode
(
value
))
except
ValueError
as
exception
:
exception_message
=
"{message}, Block-location:{location}, Key:{key}, Value:{value}"
.
format
(
message
=
exception
.
message
,
location
=
unicode
(
self
.
location
),
key
=
key
,
value
=
unicode
(
value
)
)
raise
ValueError
(
exception_message
)
for
source
in
self
.
html5_sources
:
for
source
in
self
.
html5_sources
:
ele
=
etree
.
Element
(
'source'
)
ele
=
etree
.
Element
(
'source'
)
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
ba280e2c
...
@@ -411,7 +411,15 @@ class XModuleMixin(XModuleFields, XBlock):
...
@@ -411,7 +411,15 @@ class XModuleMixin(XModuleFields, XBlock):
result
=
{}
result
=
{}
for
field
in
self
.
fields
.
values
():
for
field
in
self
.
fields
.
values
():
if
field
.
scope
==
scope
and
field
.
is_set_on
(
self
):
if
field
.
scope
==
scope
and
field
.
is_set_on
(
self
):
try
:
result
[
field
.
name
]
=
field
.
read_json
(
self
)
result
[
field
.
name
]
=
field
.
read_json
(
self
)
except
TypeError
as
exception
:
exception_message
=
"{message}, Block-location:{location}, Field-name:{field_name}"
.
format
(
message
=
exception
.
message
,
location
=
unicode
(
self
.
location
),
field_name
=
field
.
name
)
raise
TypeError
(
exception_message
)
return
result
return
result
def
has_children_at_depth
(
self
,
depth
):
def
has_children_at_depth
(
self
,
depth
):
...
...
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