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
f3c898a9
Commit
f3c898a9
authored
Sep 15, 2014
by
John Eskew
Committed by
Zia Fazal
Apr 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add bulk_operations wrapper around all course-query-intensive Studio views.
parent
6ef76489
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
68 deletions
+69
-68
cms/djangoapps/contentstore/views/component.py
+69
-68
cms/djangoapps/contentstore/views/course.py
+0
-0
cms/djangoapps/contentstore/views/item.py
+0
-0
No files found.
cms/djangoapps/contentstore/views/component.py
View file @
f3c898a9
...
@@ -141,74 +141,75 @@ def container_handler(request, usage_key_string):
...
@@ -141,74 +141,75 @@ def container_handler(request, usage_key_string):
if
'text/html'
in
request
.
META
.
get
(
'HTTP_ACCEPT'
,
'text/html'
):
if
'text/html'
in
request
.
META
.
get
(
'HTTP_ACCEPT'
,
'text/html'
):
usage_key
=
UsageKey
.
from_string
(
usage_key_string
)
usage_key
=
UsageKey
.
from_string
(
usage_key_string
)
try
:
with
modulestore
()
.
bulk_operations
(
usage_key
.
course_key
):
course
,
xblock
,
lms_link
=
_get_item_in_course
(
request
,
usage_key
)
try
:
except
ItemNotFoundError
:
course
,
xblock
,
lms_link
=
_get_item_in_course
(
request
,
usage_key
)
return
HttpResponseBadRequest
()
except
ItemNotFoundError
:
return
HttpResponseBadRequest
()
component_templates
=
get_component_templates
(
course
)
ancestor_xblocks
=
[]
component_templates
=
get_component_templates
(
course
)
parent
=
get_parent_xblock
(
xblock
)
ancestor_xblocks
=
[]
action
=
request
.
REQUEST
.
get
(
'action'
,
'view'
)
parent
=
get_parent_xblock
(
xblock
)
action
=
request
.
REQUEST
.
get
(
'action'
,
'view'
)
is_unit_page
=
is_unit
(
xblock
)
unit
=
xblock
if
is_unit_page
else
None
is_unit_page
=
is_unit
(
xblock
)
unit
=
xblock
if
is_unit_page
else
None
while
parent
and
parent
.
category
!=
'course'
:
if
unit
is
None
and
is_unit
(
parent
):
while
parent
and
parent
.
category
!=
'course'
:
unit
=
parent
if
unit
is
None
and
is_unit
(
parent
):
ancestor_xblocks
.
append
(
parent
)
unit
=
parent
parent
=
get_parent_xblock
(
parent
)
ancestor_xblocks
.
append
(
parent
)
ancestor_xblocks
.
reverse
()
parent
=
get_parent_xblock
(
parent
)
ancestor_xblocks
.
reverse
()
assert
unit
is
not
None
,
"Could not determine unit page"
subsection
=
get_parent_xblock
(
unit
)
assert
unit
is
not
None
,
"Could not determine unit page"
assert
subsection
is
not
None
,
"Could not determine parent subsection from unit "
+
unicode
(
unit
.
location
)
subsection
=
get_parent_xblock
(
unit
)
section
=
get_parent_xblock
(
subsection
)
assert
subsection
is
not
None
,
"Could not determine parent subsection from unit "
+
unicode
(
unit
.
location
)
assert
section
is
not
None
,
"Could not determine ancestor section from unit "
+
unicode
(
unit
.
location
)
section
=
get_parent_xblock
(
subsection
)
assert
section
is
not
None
,
"Could not determine ancestor section from unit "
+
unicode
(
unit
.
location
)
# Fetch the XBlock info for use by the container page. Note that it includes information
# about the block's ancestors and siblings for use by the Unit Outline.
# Fetch the XBlock info for use by the container page. Note that it includes information
xblock_info
=
create_xblock_info
(
xblock
,
include_ancestor_info
=
is_unit_page
)
# about the block's ancestors and siblings for use by the Unit Outline.
xblock_info
=
create_xblock_info
(
xblock
,
include_ancestor_info
=
is_unit_page
)
# Create the link for preview.
preview_lms_base
=
settings
.
FEATURES
.
get
(
'PREVIEW_LMS_BASE'
)
# Create the link for preview.
# need to figure out where this item is in the list of children as the
preview_lms_base
=
settings
.
FEATURES
.
get
(
'PREVIEW_LMS_BASE'
)
# preview will need this
# need to figure out where this item is in the list of children as the
index
=
1
# preview will need this
for
child
in
subsection
.
get_children
():
index
=
1
if
child
.
location
==
unit
.
location
:
for
child
in
subsection
.
get_children
():
break
if
child
.
location
==
unit
.
location
:
index
+=
1
break
preview_lms_link
=
(
index
+=
1
u'//{preview_lms_base}/courses/{org}/{course}/{course_name}/courseware/{section}/{subsection}/{index}'
preview_lms_link
=
(
)
.
format
(
u'//{preview_lms_base}/courses/{org}/{course}/{course_name}/courseware/{section}/{subsection}/{index}'
preview_lms_base
=
preview_lms_base
,
)
.
format
(
lms_base
=
settings
.
LMS_BASE
,
preview_lms_base
=
preview_lms_base
,
org
=
course
.
location
.
org
,
lms_base
=
settings
.
LMS_BASE
,
course
=
course
.
location
.
course
,
org
=
course
.
location
.
org
,
course_name
=
course
.
location
.
name
,
course
=
course
.
location
.
course
,
section
=
section
.
location
.
name
,
course_name
=
course
.
location
.
name
,
subsection
=
subsection
.
location
.
name
,
section
=
section
.
location
.
name
,
index
=
index
subsection
=
subsection
.
location
.
name
,
)
index
=
index
)
return
render_to_response
(
'container.html'
,
{
'context_course'
:
course
,
# Needed only for display of menus at top of page.
return
render_to_response
(
'container.html'
,
{
'action'
:
action
,
'context_course'
:
course
,
# Needed only for display of menus at top of page.
'xblock'
:
xblock
,
'action'
:
action
,
'xblock_locator'
:
xblock
.
location
,
'xblock'
:
xblock
,
'unit'
:
unit
,
'xblock_locator'
:
xblock
.
location
,
'is_unit_page'
:
is_unit_page
,
'unit'
:
unit
,
'subsection'
:
subsection
,
'is_unit_page'
:
is_unit_page
,
'section'
:
section
,
'subsection'
:
subsection
,
'new_unit_category'
:
'vertical'
,
'section'
:
section
,
'ancestor_xblocks'
:
ancestor_xblocks
,
'new_unit_category'
:
'vertical'
,
'component_templates'
:
json
.
dumps
(
component_templates
),
'ancestor_xblocks'
:
ancestor_xblocks
,
'xblock_info'
:
xblock_info
,
'component_templates'
:
json
.
dumps
(
component_templates
),
'draft_preview_link'
:
preview_lms_link
,
'xblock_info'
:
xblock_info
,
'published_preview_link'
:
lms_link
,
'draft_preview_link'
:
preview_lms_link
,
})
'published_preview_link'
:
lms_link
,
})
else
:
else
:
return
HttpResponseBadRequest
(
"Only supports HTML requests"
)
return
HttpResponseBadRequest
(
"Only supports HTML requests"
)
...
...
cms/djangoapps/contentstore/views/course.py
View file @
f3c898a9
This diff is collapsed.
Click to expand it.
cms/djangoapps/contentstore/views/item.py
View file @
f3c898a9
This diff is collapsed.
Click to expand it.
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