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
264e324c
Commit
264e324c
authored
Jul 16, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed format of start date parsing to ISO 8601
parent
f9de9623
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
common/lib/xmodule/xmodule/course_module.py
+5
-6
lms/djangoapps/courseware/decorators.py
+2
-2
No files found.
common/lib/xmodule/xmodule/course_module.py
View file @
264e324c
from
datetime
import
datetime
,
dat
e
import
tim
e
import
dateutil.parser
import
dateutil.parser
from
fs.errors
import
ResourceNotFoundError
from
fs.errors
import
ResourceNotFoundError
import
logging
import
logging
...
@@ -19,16 +19,16 @@ class CourseDescriptor(SequenceDescriptor):
...
@@ -19,16 +19,16 @@ class CourseDescriptor(SequenceDescriptor):
super
(
CourseDescriptor
,
self
)
.
__init__
(
system
,
definition
,
**
kwargs
)
super
(
CourseDescriptor
,
self
)
.
__init__
(
system
,
definition
,
**
kwargs
)
try
:
try
:
self
.
start
=
dateutil
.
parser
.
parse
(
self
.
metadata
[
"start"
]
)
self
.
start
=
time
.
strptime
(
self
.
metadata
[
"start"
],
"
%
Y-
%
m-
%
dT
%
H:
%
M"
)
except
KeyError
:
except
KeyError
:
self
.
start
=
date
.
fromtimestamp
(
0
)
#The epoch
self
.
start
=
time
.
gmtime
(
0
)
#The epoch
log
.
critical
(
"Course loaded without a start date. "
+
str
(
self
.
id
))
log
.
critical
(
"Course loaded without a start date. "
+
str
(
self
.
id
))
except
ValueError
,
e
:
except
ValueError
,
e
:
self
.
start
=
date
.
fromtimestamp
(
0
)
#The epoch
self
.
start
=
time
.
gmtime
(
0
)
#The epoch
log
.
critical
(
"Course loaded with a bad start date. "
+
str
(
self
.
id
)
+
" '"
+
str
(
e
)
+
"'"
)
log
.
critical
(
"Course loaded with a bad start date. "
+
str
(
self
.
id
)
+
" '"
+
str
(
e
)
+
"'"
)
def
has_started
(
self
):
def
has_started
(
self
):
return
datetime
.
now
()
>
self
.
start
return
time
.
gmtime
()
>
self
.
start
@classmethod
@classmethod
def
id_to_location
(
cls
,
course_id
):
def
id_to_location
(
cls
,
course_id
):
...
@@ -86,7 +86,6 @@ class CourseDescriptor(SequenceDescriptor):
...
@@ -86,7 +86,6 @@ class CourseDescriptor(SequenceDescriptor):
elif
section_key
==
"title"
:
elif
section_key
==
"title"
:
return
self
.
metadata
.
get
(
'display_name'
,
self
.
name
)
return
self
.
metadata
.
get
(
'display_name'
,
self
.
name
)
elif
section_key
==
"university"
:
elif
section_key
==
"university"
:
return
self
.
metadata
.
get
(
'start'
)
return
self
.
location
.
org
return
self
.
location
.
org
elif
section_key
==
"number"
:
elif
section_key
==
"number"
:
return
self
.
number
return
self
.
number
...
...
lms/djangoapps/courseware/decorators.py
View file @
264e324c
...
@@ -30,9 +30,9 @@ def check_course(course_must_be_open=True, course_required=True):
...
@@ -30,9 +30,9 @@ def check_course(course_must_be_open=True, course_required=True):
course
=
modulestore
()
.
get_item
(
course_loc
)
course
=
modulestore
()
.
get_item
(
course_loc
)
except
KeyError
:
except
KeyError
:
raise
Http404
(
"Course not found."
)
raise
Http404
(
"Course not found."
)
if
course_must_be_open
and
not
course
.
has_started
():
if
course_must_be_open
and
not
course
.
has_started
():
raise
Http404
raise
Http404
(
"This course has not yet started."
)
del
kwargs
[
'course_id'
]
del
kwargs
[
'course_id'
]
kwargs
[
'course'
]
=
course
kwargs
[
'course'
]
=
course
...
...
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