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
78c83589
Commit
78c83589
authored
Mar 11, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up pyling violations from views.py
parent
fb407e3c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
cms/djangoapps/contentstore/views.py
+25
-3
No files found.
cms/djangoapps/contentstore/views.py
View file @
78c83589
...
...
@@ -86,12 +86,14 @@ def signup(request):
csrf_token
=
csrf
(
request
)[
'csrf_token'
]
return
render_to_response
(
'signup.html'
,
{
'csrf'
:
csrf_token
})
def
old_login_redirect
(
request
):
'''
Redirect to the active login url.
'''
return
redirect
(
'login'
,
permanent
=
True
)
@ssl_login_shortcut
@ensure_csrf_cookie
def
login_page
(
request
):
...
...
@@ -104,6 +106,7 @@ def login_page(request):
'forgot_password_link'
:
"//{base}/#forgot-password-modal"
.
format
(
base
=
settings
.
LMS_BASE
),
})
def
howitworks
(
request
):
if
request
.
user
.
is_authenticated
():
return
index
(
request
)
...
...
@@ -112,6 +115,7 @@ def howitworks(request):
# ==== Views for any logged-in user ==================================
@login_required
@ensure_csrf_cookie
def
index
(
request
):
...
...
@@ -145,6 +149,7 @@ def index(request):
# ==== Views with per-item permissions================================
def
has_access
(
user
,
location
,
role
=
STAFF_ROLE_NAME
):
'''
Return True if user allowed to access this piece of data
...
...
@@ -393,6 +398,7 @@ def preview_component(request, location):
'editor'
:
wrap_xmodule
(
component
.
get_html
,
component
,
'xmodule_edit.html'
)(),
})
@expect_json
@login_required
@ensure_csrf_cookie
...
...
@@ -709,6 +715,7 @@ def create_draft(request):
return
HttpResponse
()
@login_required
@expect_json
def
publish_draft
(
request
):
...
...
@@ -738,6 +745,7 @@ def unpublish_unit(request):
return
HttpResponse
()
@login_required
@expect_json
def
clone_item
(
request
):
...
...
@@ -768,8 +776,7 @@ def clone_item(request):
return
HttpResponse
(
json
.
dumps
({
'id'
:
dest_location
.
url
()}))
#@login_required
#@ensure_csrf_cookie
def
upload_asset
(
request
,
org
,
course
,
coursename
):
'''
cdodge: this method allows for POST uploading of files into the course asset library, which will
...
...
@@ -831,6 +838,7 @@ def upload_asset(request, org, course, coursename):
response
[
'asset_url'
]
=
StaticContent
.
get_url_path_from_location
(
content
.
location
)
return
response
'''
This view will return all CMS users who are editors for the specified course
'''
...
...
@@ -863,6 +871,7 @@ def create_json_response(errmsg = None):
return
resp
'''
This POST-back view will add a user - specified by email - to the list of editors for
the specified course
...
...
@@ -895,6 +904,7 @@ def add_user(request, location):
return
create_json_response
()
'''
This POST-back view will remove a user - specified by email - from the list of editors for
the specified course
...
...
@@ -926,6 +936,7 @@ def remove_user(request, location):
def
landing
(
request
,
org
,
course
,
coursename
):
return
render_to_response
(
'temp-course-landing.html'
,
{})
@login_required
@ensure_csrf_cookie
def
static_pages
(
request
,
org
,
course
,
coursename
):
...
...
@@ -1029,6 +1040,7 @@ def edit_tabs(request, org, course, coursename):
'components'
:
components
})
def
not_found
(
request
):
return
render_to_response
(
'error.html'
,
{
'error'
:
'404'
})
...
...
@@ -1064,6 +1076,7 @@ def course_info(request, org, course, name, provided_id=None):
'handouts_location'
:
Location
([
'i4x'
,
org
,
course
,
'course_info'
,
'handouts'
])
.
url
()
})
@expect_json
@login_required
@ensure_csrf_cookie
...
...
@@ -1161,6 +1174,7 @@ def get_course_settings(request, org, course, name):
"section"
:
"details"
})
})
@login_required
@ensure_csrf_cookie
def
course_config_graders_page
(
request
,
org
,
course
,
name
):
...
...
@@ -1184,6 +1198,7 @@ def course_config_graders_page(request, org, course, name):
'course_details'
:
json
.
dumps
(
course_details
,
cls
=
CourseSettingsEncoder
)
})
@login_required
@ensure_csrf_cookie
def
course_config_advanced_page
(
request
,
org
,
course
,
name
):
...
...
@@ -1207,6 +1222,7 @@ def course_config_advanced_page(request, org, course, name):
'advanced_dict'
:
json
.
dumps
(
CourseMetadata
.
fetch
(
location
)),
})
@expect_json
@login_required
@ensure_csrf_cookie
...
...
@@ -1238,6 +1254,7 @@ def course_settings_updates(request, org, course, name, section):
return
HttpResponse
(
json
.
dumps
(
manager
.
update_from_json
(
request
.
POST
),
cls
=
CourseSettingsEncoder
),
mimetype
=
"application/json"
)
@expect_json
@login_required
@ensure_csrf_cookie
...
...
@@ -1272,7 +1289,7 @@ def course_grader_updates(request, org, course, name, grader_index=None):
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
update_grader_from_json
(
Location
([
'i4x'
,
org
,
course
,
'course'
,
name
]),
request
.
POST
)),
mimetype
=
"application/json"
)
## NB: expect_json failed on ["key", "key2"] and json payload
@login_required
@ensure_csrf_cookie
...
...
@@ -1363,6 +1380,7 @@ def asset_index(request, org, course, name):
def
edge
(
request
):
return
render_to_response
(
'university_profiles/edge.html'
,
{})
@login_required
@expect_json
def
create_new_course
(
request
):
...
...
@@ -1418,6 +1436,7 @@ def create_new_course(request):
return
HttpResponse
(
json
.
dumps
({
'id'
:
new_course
.
location
.
url
()}))
def
initialize_course_tabs
(
course
):
# set up the default tabs
# I've added this because when we add static tabs, the LMS either expects a None for the tabs list or
...
...
@@ -1435,6 +1454,7 @@ def initialize_course_tabs(course):
modulestore
(
'direct'
)
.
update_metadata
(
course
.
location
.
url
(),
course
.
own_metadata
)
@ensure_csrf_cookie
@login_required
def
import_course
(
request
,
org
,
course
,
name
):
...
...
@@ -1512,6 +1532,7 @@ def import_course(request, org, course, name):
course_module
.
location
.
name
])
})
@ensure_csrf_cookie
@login_required
def
generate_export_course
(
request
,
org
,
course
,
name
):
...
...
@@ -1563,6 +1584,7 @@ def export_course(request, org, course, name):
'successful_import_redirect_url'
:
''
})
def
event
(
request
):
'''
A noop to swallow the analytics call so that cms methods don't spook and poor developers looking at
...
...
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