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
b7b5400c
Commit
b7b5400c
authored
Sep 18, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade pymongo
LMS-11437
parent
fc514843
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
26 additions
and
23 deletions
+26
-23
cms/djangoapps/contentstore/tests/utils.py
+2
-2
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+4
-6
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+5
-1
common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
+0
-1
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+1
-0
common/lib/xmodule/xmodule/modulestore/tests/factories.py
+2
-1
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+8
-8
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
+1
-0
common/lib/xmodule/xmodule/modulestore/tests/test_publish.py
+2
-3
requirements/edx/base.txt
+1
-1
No files found.
cms/djangoapps/contentstore/tests/utils.py
View file @
b7b5400c
...
...
@@ -72,10 +72,10 @@ class CourseTestCase(ModuleStoreTestCase):
will be cleared out before each test case execution and deleted
afterwards.
"""
user_password
=
super
(
CourseTestCase
,
self
)
.
setUp
()
self
.
user_password
=
super
(
CourseTestCase
,
self
)
.
setUp
()
self
.
client
=
AjaxEnabledTestClient
()
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
user_password
)
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
self
.
user_password
)
self
.
course
=
CourseFactory
.
create
()
...
...
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
b7b5400c
...
...
@@ -1137,7 +1137,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
'''
return
self
.
get_course
(
location
.
course_key
,
depth
)
def
_update_single_item
(
self
,
location
,
update
):
def
_update_single_item
(
self
,
location
,
update
,
allow_not_found
=
False
):
"""
Set update on the specified item, and raises ItemNotFoundError
if the location doesn't exist
...
...
@@ -1150,10 +1150,8 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
{
'_id'
:
location
.
to_deprecated_son
()},
{
'$set'
:
update
},
multi
=
False
,
upsert
=
True
,
# Must include this to avoid the django debug toolbar (which defines the deprecated "safe=False")
# from overriding our default value set in the init method.
safe
=
self
.
collection
.
safe
upsert
=
allow_not_found
,
w
=
1
,
# wait until primary commits
)
if
result
[
'n'
]
==
0
:
raise
ItemNotFoundError
(
location
)
...
...
@@ -1205,7 +1203,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
if
xblock
.
has_children
:
children
=
self
.
_serialize_scope
(
xblock
,
Scope
.
children
)
payload
.
update
({
'definition.children'
:
children
[
'children'
]})
self
.
_update_single_item
(
xblock
.
scope_ids
.
usage_id
,
payload
)
self
.
_update_single_item
(
xblock
.
scope_ids
.
usage_id
,
payload
,
allow_not_found
=
allow_not_found
)
# update subtree edited info for ancestors
# don't update the subtree info for descendants of the publish root for efficiency
...
...
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
View file @
b7b5400c
...
...
@@ -677,7 +677,11 @@ class DraftModuleStore(MongoModuleStore):
# So, do not delete the child. It will be published when the new parent is published.
pass
super
(
DraftModuleStore
,
self
)
.
update_item
(
item
,
user_id
,
isPublish
=
True
,
is_publish_root
=
is_root
)
# update the published (not draft) item (ignoring that item is "draft"). The published
# may not exist; (if original_published is None); so, allow_not_found
super
(
DraftModuleStore
,
self
)
.
update_item
(
item
,
user_id
,
isPublish
=
True
,
is_publish_root
=
is_root
,
allow_not_found
=
True
)
to_be_deleted
.
append
(
as_draft
(
item_location
)
.
to_deprecated_son
())
# verify input conditions
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
View file @
b7b5400c
...
...
@@ -303,4 +303,3 @@ class MongoConnection(object):
],
unique
=
True
)
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
b7b5400c
...
...
@@ -196,6 +196,7 @@ class SplitBulkWriteMixin(BulkOperationsMixin):
course_key
.
replace
(
org
=
None
,
course
=
None
,
run
=
None
,
branch
=
None
)
]
# handle ignore case and general use
return
super
(
SplitBulkWriteMixin
,
self
)
.
_get_bulk_ops_record
(
course_key
.
replace
(
branch
=
None
,
version_guid
=
None
),
ignore_case
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/factories.py
View file @
b7b5400c
...
...
@@ -299,7 +299,8 @@ def check_mongo_calls(num_finds=0, num_sends=None):
if
num_sends
is
not
None
:
with
check_sum_of_calls
(
pymongo
.
message
,
[
'insert'
,
'update'
,
'delete'
],
# mongo < 2.6 uses insert, update, delete and _do_batched_insert. >= 2.6 _do_batched_write
[
'insert'
,
'update'
,
'delete'
,
'_do_batched_write_command'
,
'_do_batched_insert'
,
],
num_sends
,
num_sends
):
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
b7b5400c
...
...
@@ -660,12 +660,12 @@ class TestMixedModuleStore(CourseComparisonTest):
# Draft
# Find: find parents (definition.children query), get parent, get course (fill in run?),
# find parents of the parent (course), get inheritance items,
# get
errors, get
item (to delete subtree), get inheritance again.
# get item (to delete subtree), get inheritance again.
# Sends: delete item, update parent
# Split
# Find: active_versions, 2 structures (published & draft), definition (unnecessary)
# Sends: updated draft and published structures and active_versions
@ddt.data
((
'draft'
,
8
,
2
),
(
'split'
,
4
,
3
))
@ddt.data
((
'draft'
,
7
,
2
),
(
'split'
,
4
,
3
))
@ddt.unpack
def
test_delete_item
(
self
,
default_ms
,
max_find
,
max_send
):
"""
...
...
@@ -690,12 +690,12 @@ class TestMixedModuleStore(CourseComparisonTest):
# Draft:
# queries: find parent (definition.children), count versions of item, get parent, count grandparents,
# inheritance items, draft item, draft child,
get errors,
inheritance
# inheritance items, draft item, draft child, inheritance
# sends: delete draft vertical and update parent
# Split:
# queries: active_versions, draft and published structures, definition (unnecessary)
# sends: update published (why?), draft, and active_versions
@ddt.data
((
'draft'
,
9
,
2
),
(
'split'
,
4
,
3
))
@ddt.data
((
'draft'
,
8
,
2
),
(
'split'
,
4
,
3
))
@ddt.unpack
def
test_delete_private_vertical
(
self
,
default_ms
,
max_find
,
max_send
):
"""
...
...
@@ -741,12 +741,12 @@ class TestMixedModuleStore(CourseComparisonTest):
self
.
assertNotIn
(
vert_loc
,
course
.
children
)
# Draft:
# find: find parent (definition.children) 2x, find draft item,
check error state,
get inheritance items
# find: find parent (definition.children) 2x, find draft item, get inheritance items
# send: one delete query for specific item
# Split:
# find: active_version & structure
# send: update structure and active_versions
@ddt.data
((
'draft'
,
5
,
1
),
(
'split'
,
2
,
2
))
@ddt.data
((
'draft'
,
4
,
1
),
(
'split'
,
2
,
2
))
@ddt.unpack
def
test_delete_draft_vertical
(
self
,
default_ms
,
max_find
,
max_send
):
"""
...
...
@@ -1294,7 +1294,7 @@ class TestMixedModuleStore(CourseComparisonTest):
self
.
assertEqual
(
len
(
self
.
store
.
get_courses_for_wiki
(
'no_such_wiki'
)),
0
)
# Draft:
# Find: find vertical, find children
, get last error
# Find: find vertical, find children
# Sends:
# 1. delete all of the published nodes in subtree
# 2. insert vertical as published (deleted in step 1) w/ the deleted problems as children
...
...
@@ -1303,7 +1303,7 @@ class TestMixedModuleStore(CourseComparisonTest):
# Sends:
# - insert structure
# - write index entry
@ddt.data
((
'draft'
,
3
,
6
),
(
'split'
,
3
,
2
))
@ddt.data
((
'draft'
,
2
,
6
),
(
'split'
,
3
,
2
))
@ddt.unpack
def
test_unpublish
(
self
,
default_ms
,
max_find
,
max_send
):
"""
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
View file @
b7b5400c
...
...
@@ -573,6 +573,7 @@ class TestMongoModuleStore(unittest.TestCase):
'published_by'
:
published_by
,
},
},
allow_not_found
=
True
,
)
# Retrieve the block and verify its fields
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_publish.py
View file @
b7b5400c
...
...
@@ -98,13 +98,12 @@ class TestPublish(SplitWMongoCourseBoostrapper):
# 12-15 get each ancestor (count then get): (2 x 2),
# 16 then fail count of course parent (1)
# 17 compute inheritance
# 18 get last error
# 19-20 get draft and published vert
# 18-19 get draft and published vert
# Sends:
# delete the subtree of drafts (1 call),
# update the published version of each node in subtree (4 calls),
# update the ancestors up to course (2 calls)
with
check_mongo_calls
(
20
,
7
):
with
check_mongo_calls
(
19
,
7
):
self
.
draft_mongo
.
publish
(
item
.
location
,
self
.
user_id
)
# verify status
...
...
requirements/edx/base.txt
View file @
b7b5400c
...
...
@@ -61,7 +61,7 @@ polib==1.0.3
pycrypto>=2.6
pygments==1.6
pygraphviz==1.1
pymongo==2.
4.1
pymongo==2.
7.2
pyparsing==2.0.1
python-memcached==1.48
python-openid==2.2.5
...
...
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