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
1411fadd
Commit
1411fadd
authored
Mar 12, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix access to children via definition
parent
2a96c456
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
cms/djangoapps/contentstore/tests/test_contentstore.py
+3
-3
cms/djangoapps/contentstore/views.py
+5
-3
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
1411fadd
...
...
@@ -111,10 +111,10 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
chapter
=
module_store
.
get_item
(
Location
([
'i4x'
,
'edX'
,
'full'
,
'chapter'
,
'Week_1'
,
None
]))
# make sure the parent no longer points to the child object which was deleted
self
.
assertTrue
(
sequential
.
location
.
url
()
in
chapter
.
definition
[
'children'
]
)
self
.
assertTrue
(
sequential
.
location
.
url
()
in
chapter
.
children
)
self
.
client
.
post
(
reverse
(
'delete_item'
),
json
.
dumps
({
'id'
:
sequential
.
location
.
url
(),
'delete_children'
:
'true'
}),
json
.
dumps
({
'id'
:
sequential
.
location
.
url
(),
'delete_children'
:
'true'
}),
"application/json"
)
found
=
False
...
...
@@ -129,7 +129,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
chapter
=
module_store
.
get_item
(
Location
([
'i4x'
,
'edX'
,
'full'
,
'chapter'
,
'Week_1'
,
None
]))
# make sure the parent no longer points to the child object which was deleted
self
.
assertFalse
(
sequential
.
location
.
url
()
in
chapter
.
definition
[
'children'
]
)
self
.
assertFalse
(
sequential
.
location
.
url
()
in
chapter
.
children
)
...
...
cms/djangoapps/contentstore/views.py
View file @
1411fadd
...
...
@@ -649,9 +649,11 @@ def delete_item(request):
for
parent_loc
in
parent_locs
:
parent
=
modulestore
(
'direct'
)
.
get_item
(
parent_loc
)
item_url
=
item_loc
.
url
()
if
item_url
in
parent
.
definition
[
"children"
]:
parent
.
definition
[
"children"
]
.
remove
(
item_url
)
modulestore
(
'direct'
)
.
update_children
(
parent
.
location
,
parent
.
definition
[
"children"
])
if
item_url
in
parent
.
children
:
children
=
parent
.
children
children
.
remove
(
item_url
)
parent
.
children
=
children
modulestore
(
'direct'
)
.
update_children
(
parent
.
location
,
parent
.
children
)
return
HttpResponse
()
...
...
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