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
909fe134
Commit
909fe134
authored
Jun 05, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added date_util tests back in and handle null time obj.
parent
28f8910d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
cms/djangoapps/models/settings/course_details.py
+2
-2
common/lib/xmodule/xmodule/tests/test_date_utils.py
+20
-0
common/lib/xmodule/xmodule/util/date_utils.py
+2
-0
No files found.
cms/djangoapps/models/settings/course_details.py
View file @
909fe134
...
@@ -73,9 +73,9 @@ class CourseDetails(object):
...
@@ -73,9 +73,9 @@ class CourseDetails(object):
"""
"""
Decode the json into CourseDetails and save any changed attrs to the db
Decode the json into CourseDetails and save any changed attrs to the db
"""
"""
#
#
TODO make it an error for this to be undefined & for it to not be retrievable from modulestore
# TODO make it an error for this to be undefined & for it to not be retrievable from modulestore
course_location
=
jsondict
[
'course_location'
]
course_location
=
jsondict
[
'course_location'
]
#
#
Will probably want to cache the inflight courses because every blur generates an update
# Will probably want to cache the inflight courses because every blur generates an update
descriptor
=
get_modulestore
(
course_location
)
.
get_item
(
course_location
)
descriptor
=
get_modulestore
(
course_location
)
.
get_item
(
course_location
)
dirty
=
False
dirty
=
False
...
...
common/lib/xmodule/xmodule/tests/test_date_utils.py
0 → 100644
View file @
909fe134
# Tests for xmodule.util.date_utils
from
nose.tools
import
assert_equals
from
xmodule.util
import
date_utils
import
datetime
from
pytz
import
UTC
def
test_get_default_time_display
():
assert_equals
(
""
,
date_utils
.
get_default_time_display
(
None
))
test_time
=
datetime
.
datetime
(
1992
,
3
,
12
,
15
,
3
,
30
,
tzinfo
=
UTC
)
assert_equals
(
"Mar 12, 1992 at 15:03 UTC"
,
date_utils
.
get_default_time_display
(
test_time
))
assert_equals
(
"Mar 12, 1992 at 15:03 UTC"
,
date_utils
.
get_default_time_display
(
test_time
,
True
))
assert_equals
(
"Mar 12, 1992 at 15:03"
,
date_utils
.
get_default_time_display
(
test_time
,
False
))
common/lib/xmodule/xmodule/util/date_utils.py
View file @
909fe134
...
@@ -8,6 +8,8 @@ def get_default_time_display(dt, show_timezone=True):
...
@@ -8,6 +8,8 @@ def get_default_time_display(dt, show_timezone=True):
If None is passed in for dt, an empty string will be returned.
If None is passed in for dt, an empty string will be returned.
The default value of show_timezone is True.
The default value of show_timezone is True.
"""
"""
if
dt
is
None
:
return
""
timezone
=
""
timezone
=
""
if
dt
is
not
None
and
show_timezone
:
if
dt
is
not
None
and
show_timezone
:
if
dt
.
tzinfo
is
not
None
:
if
dt
.
tzinfo
is
not
None
:
...
...
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