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
b48d08b2
Commit
b48d08b2
authored
Jul 12, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes from pull request 170
parent
28007b28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
common/lib/xmodule/xmodule/modulestore/mongo.py
+5
-4
No files found.
common/lib/xmodule/xmodule/modulestore/mongo.py
View file @
b48d08b2
...
@@ -23,7 +23,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
...
@@ -23,7 +23,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
def
__init__
(
self
,
modulestore
,
module_data
,
default_class
,
resources_fs
,
render_template
):
def
__init__
(
self
,
modulestore
,
module_data
,
default_class
,
resources_fs
,
render_template
):
"""
"""
modulestore: the module store that can be used to retrieve additional modules
modulestore: the module store that can be used to retrieve additional modules
module_data: a
mapping of
Location -> json that was cached from the underlying modulestore
module_data: a
dict mapping
Location -> json that was cached from the underlying modulestore
default_class: The default_class to use when loading an XModuleDescriptor from the module_data
default_class: The default_class to use when loading an XModuleDescriptor from the module_data
resources_fs: a filesystem, as per MakoDescriptorSystem
resources_fs: a filesystem, as per MakoDescriptorSystem
render_template: a function for rendering templates, as per MakoDescriptorSystem
render_template: a function for rendering templates, as per MakoDescriptorSystem
...
@@ -42,15 +42,15 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
...
@@ -42,15 +42,15 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
return
XModuleDescriptor
.
load_from_json
(
json_data
,
self
,
self
.
default_class
)
return
XModuleDescriptor
.
load_from_json
(
json_data
,
self
,
self
.
default_class
)
def
location_to_query
(
loc
):
def
location_to_query
(
loc
ation
):
"""
"""
Takes a Location and returns a SON object that will query for that location.
Takes a Location and returns a SON object that will query for that location.
Fields in loc that are None are ignored in the query
Fields in loc
ation
that are None are ignored in the query
"""
"""
query
=
SON
()
query
=
SON
()
# Location dict is ordered by specificity, and SON
# Location dict is ordered by specificity, and SON
# will preserve that order for queries
# will preserve that order for queries
for
key
,
val
in
Location
(
loc
)
.
dict
()
.
iteritems
():
for
key
,
val
in
Location
(
loc
ation
)
.
dict
()
.
iteritems
():
if
val
is
not
None
:
if
val
is
not
None
:
query
[
'_id.{key}'
.
format
(
key
=
key
)]
=
val
query
[
'_id.{key}'
.
format
(
key
=
key
)]
=
val
...
@@ -106,6 +106,7 @@ class MongoModuleStore(ModuleStore):
...
@@ -106,6 +106,7 @@ class MongoModuleStore(ModuleStore):
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
:
else
:
to_process
=
[]
to_process
=
[]
# If depth is None, then we just recurse until we hit all the descendents
if
depth
is
not
None
:
if
depth
is
not
None
:
depth
-=
1
depth
-=
1
...
...
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