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
fc0a7614
Commit
fc0a7614
authored
Jan 08, 2013
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load courses in dir name order, keep separate ParentTracker per course.
parent
1db70050
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
common/lib/xmodule/xmodule/modulestore/__init__.py
+1
-1
common/lib/xmodule/xmodule/modulestore/mongo.py
+1
-1
common/lib/xmodule/xmodule/modulestore/search.py
+1
-1
common/lib/xmodule/xmodule/modulestore/xml.py
+10
-9
No files found.
common/lib/xmodule/xmodule/modulestore/__init__.py
View file @
fc0a7614
...
...
@@ -345,7 +345,7 @@ class ModuleStore(object):
'''
raise
NotImplementedError
def
get_parent_locations
(
self
,
location
):
def
get_parent_locations
(
self
,
location
,
course_id
):
'''Find all locations that are the parents of this location. Needed
for path_to_location().
...
...
common/lib/xmodule/xmodule/modulestore/mongo.py
View file @
fc0a7614
...
...
@@ -309,7 +309,7 @@ class MongoModuleStore(ModuleStoreBase):
self
.
_update_single_item
(
location
,
{
'metadata'
:
metadata
})
def
get_parent_locations
(
self
,
location
):
def
get_parent_locations
(
self
,
location
,
course_id
):
'''Find all locations that are the parents of this location. Needed
for path_to_location().
...
...
common/lib/xmodule/xmodule/modulestore/search.py
View file @
fc0a7614
...
...
@@ -64,7 +64,7 @@ def path_to_location(modulestore, course_id, location):
# isn't found so we don't have to do it explicitly. Call this
# first to make sure the location is there (even if it's a course, and
# we would otherwise immediately exit).
parents
=
modulestore
.
get_parent_locations
(
loc
)
parents
=
modulestore
.
get_parent_locations
(
loc
,
course_id
)
# print 'Processing loc={0}, path={1}'.format(loc, path)
if
loc
.
category
==
"course"
:
...
...
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
fc0a7614
...
...
@@ -275,14 +275,15 @@ class XMLModuleStore(ModuleStoreBase):
class_
=
getattr
(
import_module
(
module_path
),
class_name
)
self
.
default_class
=
class_
self
.
parent_tracker
=
ParentTracker
()
# self.parent_tracker = ParentTracker()
self
.
parent_trackers
=
defaultdict
(
ParentTracker
)
# If we are specifically asked for missing courses, that should
# be an error. If we are asked for "all" courses, find the ones
# that have a course.xml
if
course_dirs
is
None
:
course_dirs
=
[
d
for
d
in
os
.
listdir
(
self
.
data_dir
)
if
os
.
path
.
exists
(
self
.
data_dir
/
d
/
"course.xml"
)]
course_dirs
=
sorted
(
[
d
for
d
in
os
.
listdir
(
self
.
data_dir
)
if
os
.
path
.
exists
(
self
.
data_dir
/
d
/
"course.xml"
)])
for
course_dir
in
course_dirs
:
self
.
try_load_course
(
course_dir
)
...
...
@@ -307,7 +308,7 @@ class XMLModuleStore(ModuleStoreBase):
if
course_descriptor
is
not
None
:
self
.
courses
[
course_dir
]
=
course_descriptor
self
.
_location_errors
[
course_descriptor
.
location
]
=
errorlog
self
.
parent_tracker
.
make_known
(
course_descriptor
.
location
)
self
.
parent_tracker
s
[
course_descriptor
.
id
]
.
make_known
(
course_descriptor
.
location
)
else
:
# Didn't load course. Instead, save the errors elsewhere.
self
.
errored_courses
[
course_dir
]
=
errorlog
...
...
@@ -432,7 +433,7 @@ class XMLModuleStore(ModuleStoreBase):
course_dir
,
policy
,
tracker
,
self
.
parent_tracker
,
self
.
parent_tracker
s
[
course_id
]
,
self
.
load_error_modules
,
)
...
...
@@ -541,7 +542,7 @@ class XMLModuleStore(ModuleStoreBase):
"""
raise
NotImplementedError
(
"XMLModuleStores are read-only"
)
def
get_parent_locations
(
self
,
location
):
def
get_parent_locations
(
self
,
location
,
course_id
):
'''Find all locations that are the parents of this location. Needed
for path_to_location().
...
...
@@ -552,7 +553,7 @@ class XMLModuleStore(ModuleStoreBase):
be empty if there are no parents.
'''
location
=
Location
.
ensure_fully_specified
(
location
)
if
not
self
.
parent_tracker
.
is_known
(
location
):
raise
ItemNotFoundError
(
location
)
if
not
self
.
parent_tracker
s
[
course_id
]
.
is_known
(
location
):
raise
ItemNotFoundError
(
"{0} not in {1}"
.
format
(
location
,
course_id
)
)
return
self
.
parent_tracker
.
parents
(
location
)
return
self
.
parent_tracker
s
[
course_id
]
.
parents
(
location
)
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