Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
529a805c
Unverified
Commit
529a805c
authored
3 years ago
by
Awais Jibran
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixing dates serialization in course import (#27137)
parent
85515283
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/lib/xmodule/xmodule/tests/test_xml_module.py
+2
-0
2 additions, 0 deletions
common/lib/xmodule/xmodule/tests/test_xml_module.py
common/lib/xmodule/xmodule/xml_module.py
+5
-0
5 additions, 0 deletions
common/lib/xmodule/xmodule/xml_module.py
with
7 additions
and
0 deletions
common/lib/xmodule/xmodule/tests/test_xml_module.py
+
2
−
0
View file @
529a805c
...
...
@@ -4,6 +4,7 @@
import
unittest
from
unittest.mock
import
Mock
import
dateutil.parser
from
opaque_keys.edx.locator
import
BlockUsageLocator
,
CourseLocator
from
xblock.field_data
import
DictFieldData
...
...
@@ -386,6 +387,7 @@ class TestSerialize(unittest.TestCase):
assert
serialize_field
([
'
foo
'
,
'
bar
'
])
==
'
[
"
foo
"
,
"
bar
"
]
'
assert
serialize_field
(
"
2012-12-31T23:59:59Z
"
)
==
'
2012-12-31T23:59:59Z
'
assert
serialize_field
(
"
1 day 12 hours 59 minutes 59 seconds
"
)
==
'
1 day 12 hours 59 minutes 59 seconds
'
assert
serialize_field
(
dateutil
.
parser
.
parse
(
'
2012-12-31T23:59:59Z
'
))
==
'
2012-12-31T23:59:59+00:00
'
class
TestDeserialize
(
unittest
.
TestCase
):
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/xml_module.py
+
5
−
0
View file @
529a805c
# lint-amnesty, pylint: disable=missing-module-docstring
import
datetime
import
copy
import
json
...
...
@@ -65,6 +66,10 @@ def serialize_field(value):
"""
if
isinstance
(
value
,
str
):
return
value
elif
isinstance
(
value
,
datetime
.
datetime
):
if
value
.
tzinfo
is
not
None
and
value
.
utcoffset
()
is
None
:
return
value
.
isoformat
()
+
'
Z
'
return
value
.
isoformat
()
return
json
.
dumps
(
value
,
cls
=
EdxJSONEncoder
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment