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
51ae0d54
Commit
51ae0d54
authored
Jul 16, 2012
by
Victor Shnayder
Committed by
Calen Pennington
Jul 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve docstrings and formating in mongo.py
parent
61446b05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
common/lib/xmodule/xmodule/modulestore/mongo.py
+13
-8
No files found.
common/lib/xmodule/xmodule/modulestore/mongo.py
View file @
51ae0d54
...
...
@@ -93,7 +93,9 @@ class MongoModuleStore(ModuleStore):
"""
Returns a dictionary mapping Location -> item data, populated with json data
for all descendents of items up to the specified depth.
This will make a number of queries that is linear in the depth
(0 = no descendents, 1 = children, 2 = grandchildren, etc)
If depth is None, will load all the children.
This will make a number of queries that is linear in the depth.
"""
data
=
{}
to_process
=
list
(
items
)
...
...
@@ -108,7 +110,8 @@ class MongoModuleStore(ModuleStore):
# http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24or
# for or-query syntax
if
children
:
to_process
=
list
(
self
.
collection
.
find
({
'_id'
:
{
'$in'
:
[
Location
(
child
)
.
dict
()
for
child
in
children
]}}))
to_process
=
list
(
self
.
collection
.
find
(
{
'_id'
:
{
'$in'
:
[
Location
(
child
)
.
dict
()
for
child
in
children
]}}))
else
:
to_process
=
[]
# If depth is None, then we just recurse until we hit all the descendents
...
...
@@ -142,17 +145,19 @@ class MongoModuleStore(ModuleStore):
def
get_item
(
self
,
location
,
depth
=
0
):
"""
Returns an XModuleDescriptor instance for the item at location.
If location.revision is None, returns the
most
item with the most
recent revision
If location.revision is None, returns the item with the most
recent revision
.
If any segment of the location is None except revision, raises
xmodule.modulestore.exceptions.InsufficientSpecificationError
If no object is found at that location, raises xmodule.modulestore.exceptions.ItemNotFoundError
If no object is found at that location, raises
xmodule.modulestore.exceptions.ItemNotFoundError
location: a Location object
depth (int): An argument that some module stores may use to prefetch descendents of the queried modules
for more efficient results later in the request. The depth is counted in the number of
calls to get_children() to cache. None indicates to cache all descendents
depth (int): An argument that some module stores may use to prefetch
descendents of the queried modules for more efficient results later
in the request. The depth is counted in the number of
calls to get_children() to cache. None indicates to cache all descendents.
"""
...
...
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