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
9e16e85d
Commit
9e16e85d
authored
Jul 16, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up check_course decorator a bit.
parent
e2fa089e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
lms/djangoapps/courseware/decorators.py
+4
-8
No files found.
lms/djangoapps/courseware/decorators.py
View file @
9e16e85d
...
...
@@ -6,7 +6,7 @@ from xmodule.course_module import CourseDescriptor
from
xmodule.modulestore.django
import
modulestore
def
check_course
(
course_must_be_open
=
True
,
course_required
=
True
):
def
check_course
(
function
=
None
,
course_must_be_open
=
True
,
course_required
=
True
):
"""
This is a decorator for views that are within a course.
It converts the string passed to the view as 'course_id'
...
...
@@ -58,11 +58,7 @@ def check_course(course_must_be_open=True, course_required=True):
return
function
(
*
args
,
**
kwargs
)
return
wrapped_function
# If no arguments were passed to the decorator, the function itself
# will be in course_must_be_open
if
callable
(
course_must_be_open
):
function
=
course_must_be_open
course_must_be_open
=
True
return
inner_check_course
(
function
)
else
:
if
function
is
None
:
return
inner_check_course
else
:
return
inner_check_course
(
function
)
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