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
d815d50a
Commit
d815d50a
authored
Aug 30, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove obsolete eager flag for xml modulestore
* has to be eager
parent
484735bf
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
14 additions
and
28 deletions
+14
-28
common/lib/xmodule/xmodule/modulestore/tests/test_xml.py
+1
-1
common/lib/xmodule/xmodule/modulestore/xml.py
+1
-11
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+1
-2
common/lib/xmodule/xmodule/tests/test_export.py
+2
-2
common/lib/xmodule/xmodule/tests/test_import.py
+4
-4
lms/djangoapps/courseware/management/commands/clean_xml.py
+0
-1
lms/djangoapps/courseware/management/commands/metadata_to_json.py
+0
-1
lms/djangoapps/courseware/tests/tests.py
+0
-1
lms/djangoapps/django_comment_client/utils.py
+5
-4
lms/envs/common.py
+0
-1
No files found.
common/lib/xmodule/xmodule/modulestore/tests/test_xml.py
View file @
d815d50a
...
@@ -10,7 +10,7 @@ class TestXMLModuleStore(object):
...
@@ -10,7 +10,7 @@ class TestXMLModuleStore(object):
"""Make sure that path_to_location works properly"""
"""Make sure that path_to_location works properly"""
print
"Starting import"
print
"Starting import"
modulestore
=
XMLModuleStore
(
DATA_DIR
,
eager
=
True
,
course_dirs
=
[
'toy'
,
'simple'
])
modulestore
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
'toy'
,
'simple'
])
print
"finished import"
print
"finished import"
check_path_to_location
(
modulestore
)
check_path_to_location
(
modulestore
)
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
d815d50a
...
@@ -195,8 +195,7 @@ class XMLModuleStore(ModuleStoreBase):
...
@@ -195,8 +195,7 @@ class XMLModuleStore(ModuleStoreBase):
"""
"""
An XML backed ModuleStore
An XML backed ModuleStore
"""
"""
def
__init__
(
self
,
data_dir
,
default_class
=
None
,
eager
=
False
,
def
__init__
(
self
,
data_dir
,
default_class
=
None
,
course_dirs
=
None
):
course_dirs
=
None
):
"""
"""
Initialize an XMLModuleStore from data_dir
Initialize an XMLModuleStore from data_dir
...
@@ -205,15 +204,11 @@ class XMLModuleStore(ModuleStoreBase):
...
@@ -205,15 +204,11 @@ class XMLModuleStore(ModuleStoreBase):
default_class: dot-separated string defining the default descriptor
default_class: dot-separated string defining the default descriptor
class to use if none is specified in entry_points
class to use if none is specified in entry_points
eager: If true, load the modules children immediately to force the
entire course tree to be parsed
course_dirs: If specified, the list of course_dirs to load. Otherwise,
course_dirs: If specified, the list of course_dirs to load. Otherwise,
load all course dirs
load all course dirs
"""
"""
ModuleStoreBase
.
__init__
(
self
)
ModuleStoreBase
.
__init__
(
self
)
self
.
eager
=
eager
self
.
data_dir
=
path
(
data_dir
)
self
.
data_dir
=
path
(
data_dir
)
self
.
modules
=
defaultdict
(
dict
)
# course_id -> dict(location -> XModuleDescriptor)
self
.
modules
=
defaultdict
(
dict
)
# course_id -> dict(location -> XModuleDescriptor)
self
.
courses
=
{}
# course_dir -> XModuleDescriptor for the course
self
.
courses
=
{}
# course_dir -> XModuleDescriptor for the course
...
@@ -226,11 +221,6 @@ class XMLModuleStore(ModuleStoreBase):
...
@@ -226,11 +221,6 @@ class XMLModuleStore(ModuleStoreBase):
class_
=
getattr
(
import_module
(
module_path
),
class_name
)
class_
=
getattr
(
import_module
(
module_path
),
class_name
)
self
.
default_class
=
class_
self
.
default_class
=
class_
# TODO (cpennington): We need a better way of selecting specific sets of
# debug messages to enable. These were drowning out important messages
#log.debug('XMLModuleStore: eager=%s, data_dir = %s' % (eager, self.data_dir))
#log.debug('default_class = %s' % self.default_class)
self
.
parent_tracker
=
ParentTracker
()
self
.
parent_tracker
=
ParentTracker
()
# If we are specifically asked for missing courses, that should
# If we are specifically asked for missing courses, that should
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
d815d50a
...
@@ -6,7 +6,7 @@ from .exceptions import DuplicateItemError
...
@@ -6,7 +6,7 @@ from .exceptions import DuplicateItemError
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
def
import_from_xml
(
store
,
data_dir
,
course_dirs
=
None
,
eager
=
True
,
def
import_from_xml
(
store
,
data_dir
,
course_dirs
=
None
,
default_class
=
'xmodule.raw_module.RawDescriptor'
):
default_class
=
'xmodule.raw_module.RawDescriptor'
):
"""
"""
Import the specified xml data_dir into the "store" modulestore,
Import the specified xml data_dir into the "store" modulestore,
...
@@ -19,7 +19,6 @@ def import_from_xml(store, data_dir, course_dirs=None, eager=True,
...
@@ -19,7 +19,6 @@ def import_from_xml(store, data_dir, course_dirs=None, eager=True,
module_store
=
XMLModuleStore
(
module_store
=
XMLModuleStore
(
data_dir
,
data_dir
,
default_class
=
default_class
,
default_class
=
default_class
,
eager
=
eager
,
course_dirs
=
course_dirs
course_dirs
=
course_dirs
)
)
for
course_id
in
module_store
.
modules
.
keys
():
for
course_id
in
module_store
.
modules
.
keys
():
...
...
common/lib/xmodule/xmodule/tests/test_export.py
View file @
d815d50a
...
@@ -49,7 +49,7 @@ class RoundTripTestCase(unittest.TestCase):
...
@@ -49,7 +49,7 @@ class RoundTripTestCase(unittest.TestCase):
copytree
(
data_dir
/
course_dir
,
root_dir
/
course_dir
)
copytree
(
data_dir
/
course_dir
,
root_dir
/
course_dir
)
print
"Starting import"
print
"Starting import"
initial_import
=
XMLModuleStore
(
root_dir
,
eager
=
True
,
course_dirs
=
[
course_dir
])
initial_import
=
XMLModuleStore
(
root_dir
,
course_dirs
=
[
course_dir
])
courses
=
initial_import
.
get_courses
()
courses
=
initial_import
.
get_courses
()
self
.
assertEquals
(
len
(
courses
),
1
)
self
.
assertEquals
(
len
(
courses
),
1
)
...
@@ -66,7 +66,7 @@ class RoundTripTestCase(unittest.TestCase):
...
@@ -66,7 +66,7 @@ class RoundTripTestCase(unittest.TestCase):
course_xml
.
write
(
xml
)
course_xml
.
write
(
xml
)
print
"Starting second import"
print
"Starting second import"
second_import
=
XMLModuleStore
(
root_dir
,
eager
=
True
,
course_dirs
=
[
course_dir
])
second_import
=
XMLModuleStore
(
root_dir
,
course_dirs
=
[
course_dir
])
courses2
=
second_import
.
get_courses
()
courses2
=
second_import
.
get_courses
()
self
.
assertEquals
(
len
(
courses2
),
1
)
self
.
assertEquals
(
len
(
courses2
),
1
)
...
...
common/lib/xmodule/xmodule/tests/test_import.py
View file @
d815d50a
...
@@ -193,7 +193,7 @@ class ImportTestCase(unittest.TestCase):
...
@@ -193,7 +193,7 @@ class ImportTestCase(unittest.TestCase):
"""Make sure that metadata is inherited properly"""
"""Make sure that metadata is inherited properly"""
print
"Starting import"
print
"Starting import"
initial_import
=
XMLModuleStore
(
DATA_DIR
,
eager
=
True
,
course_dirs
=
[
'toy'
])
initial_import
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
'toy'
])
courses
=
initial_import
.
get_courses
()
courses
=
initial_import
.
get_courses
()
self
.
assertEquals
(
len
(
courses
),
1
)
self
.
assertEquals
(
len
(
courses
),
1
)
...
@@ -216,7 +216,7 @@ class ImportTestCase(unittest.TestCase):
...
@@ -216,7 +216,7 @@ class ImportTestCase(unittest.TestCase):
def
get_course
(
name
):
def
get_course
(
name
):
print
"Importing {0}"
.
format
(
name
)
print
"Importing {0}"
.
format
(
name
)
modulestore
=
XMLModuleStore
(
DATA_DIR
,
eager
=
True
,
course_dirs
=
[
name
])
modulestore
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
name
])
courses
=
modulestore
.
get_courses
()
courses
=
modulestore
.
get_courses
()
self
.
assertEquals
(
len
(
courses
),
1
)
self
.
assertEquals
(
len
(
courses
),
1
)
return
courses
[
0
]
return
courses
[
0
]
...
@@ -245,7 +245,7 @@ class ImportTestCase(unittest.TestCase):
...
@@ -245,7 +245,7 @@ class ImportTestCase(unittest.TestCase):
happen--locations should uniquely name definitions. But in
happen--locations should uniquely name definitions. But in
our imperfect XML world, it can (and likely will) happen."""
our imperfect XML world, it can (and likely will) happen."""
modulestore
=
XMLModuleStore
(
DATA_DIR
,
eager
=
True
,
course_dirs
=
[
'toy'
,
'two_toys'
])
modulestore
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
'toy'
,
'two_toys'
])
toy_id
=
"edX/toy/2012_Fall"
toy_id
=
"edX/toy/2012_Fall"
two_toy_id
=
"edX/toy/TT_2012_Fall"
two_toy_id
=
"edX/toy/TT_2012_Fall"
...
@@ -261,7 +261,7 @@ class ImportTestCase(unittest.TestCase):
...
@@ -261,7 +261,7 @@ class ImportTestCase(unittest.TestCase):
"""Ensure that colons in url_names convert to file paths properly"""
"""Ensure that colons in url_names convert to file paths properly"""
print
"Starting import"
print
"Starting import"
modulestore
=
XMLModuleStore
(
DATA_DIR
,
eager
=
True
,
course_dirs
=
[
'toy'
])
modulestore
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
'toy'
])
courses
=
modulestore
.
get_courses
()
courses
=
modulestore
.
get_courses
()
self
.
assertEquals
(
len
(
courses
),
1
)
self
.
assertEquals
(
len
(
courses
),
1
)
...
...
lms/djangoapps/courseware/management/commands/clean_xml.py
View file @
d815d50a
...
@@ -57,7 +57,6 @@ def import_with_checks(course_dir, verbose=True):
...
@@ -57,7 +57,6 @@ def import_with_checks(course_dir, verbose=True):
# module.
# module.
modulestore
=
XMLModuleStore
(
data_dir
,
modulestore
=
XMLModuleStore
(
data_dir
,
default_class
=
None
,
default_class
=
None
,
eager
=
True
,
course_dirs
=
course_dirs
)
course_dirs
=
course_dirs
)
def
str_of_err
(
tpl
):
def
str_of_err
(
tpl
):
...
...
lms/djangoapps/courseware/management/commands/metadata_to_json.py
View file @
d815d50a
...
@@ -23,7 +23,6 @@ def import_course(course_dir, verbose=True):
...
@@ -23,7 +23,6 @@ def import_course(course_dir, verbose=True):
# module.
# module.
modulestore
=
XMLModuleStore
(
data_dir
,
modulestore
=
XMLModuleStore
(
data_dir
,
default_class
=
None
,
default_class
=
None
,
eager
=
True
,
course_dirs
=
course_dirs
)
course_dirs
=
course_dirs
)
def
str_of_err
(
tpl
):
def
str_of_err
(
tpl
):
...
...
lms/djangoapps/courseware/tests/tests.py
View file @
d815d50a
...
@@ -68,7 +68,6 @@ def xml_store_config(data_dir):
...
@@ -68,7 +68,6 @@ def xml_store_config(data_dir):
'OPTIONS'
:
{
'OPTIONS'
:
{
'data_dir'
:
data_dir
,
'data_dir'
:
data_dir
,
'default_class'
:
'xmodule.hidden_module.HiddenDescriptor'
,
'default_class'
:
'xmodule.hidden_module.HiddenDescriptor'
,
'eager'
:
True
,
}
}
}
}
}
}
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
d815d50a
...
@@ -43,7 +43,8 @@ def get_full_modules():
...
@@ -43,7 +43,8 @@ def get_full_modules():
class_path
=
settings
.
MODULESTORE
[
'default'
][
'ENGINE'
]
class_path
=
settings
.
MODULESTORE
[
'default'
][
'ENGINE'
]
module_path
,
_
,
class_name
=
class_path
.
rpartition
(
'.'
)
module_path
,
_
,
class_name
=
class_path
.
rpartition
(
'.'
)
class_
=
getattr
(
import_module
(
module_path
),
class_name
)
class_
=
getattr
(
import_module
(
module_path
),
class_name
)
modulestore
=
class_
(
**
dict
(
settings
.
MODULESTORE
[
'default'
][
'OPTIONS'
]
.
items
()
+
[(
'eager'
,
True
)]))
# TODO (vshnayder): wth is this doing???
modulestore
=
class_
(
**
dict
(
settings
.
MODULESTORE
[
'default'
][
'OPTIONS'
]
.
items
()))
_FULLMODULES
=
modulestore
.
modules
_FULLMODULES
=
modulestore
.
modules
return
_FULLMODULES
return
_FULLMODULES
...
@@ -76,7 +77,7 @@ def initialize_discussion_info(request, course):
...
@@ -76,7 +77,7 @@ def initialize_discussion_info(request, course):
_is_course_discussion
=
lambda
x
:
x
[
0
]
.
dict
()[
'category'
]
==
'discussion'
\
_is_course_discussion
=
lambda
x
:
x
[
0
]
.
dict
()[
'category'
]
==
'discussion'
\
and
x
[
0
]
.
dict
()[
'course'
]
==
course_name
and
x
[
0
]
.
dict
()[
'course'
]
==
course_name
_get_module_descriptor
=
operator
.
itemgetter
(
1
)
_get_module_descriptor
=
operator
.
itemgetter
(
1
)
def
_get_module
(
module_descriptor
):
def
_get_module
(
module_descriptor
):
...
@@ -135,8 +136,8 @@ class HtmlResponse(HttpResponse):
...
@@ -135,8 +136,8 @@ class HtmlResponse(HttpResponse):
def
__init__
(
self
,
html
=
''
):
def
__init__
(
self
,
html
=
''
):
super
(
HtmlResponse
,
self
)
.
__init__
(
html
,
content_type
=
'text/plain'
)
super
(
HtmlResponse
,
self
)
.
__init__
(
html
,
content_type
=
'text/plain'
)
class
ViewNameMiddleware
(
object
):
class
ViewNameMiddleware
(
object
):
def
process_view
(
self
,
request
,
view_func
,
view_args
,
view_kwargs
):
def
process_view
(
self
,
request
,
view_func
,
view_args
,
view_kwargs
):
request
.
view_name
=
view_func
.
__name__
request
.
view_name
=
view_func
.
__name__
class
QueryCountDebugMiddleware
(
object
):
class
QueryCountDebugMiddleware
(
object
):
...
...
lms/envs/common.py
View file @
d815d50a
...
@@ -219,7 +219,6 @@ MODULESTORE = {
...
@@ -219,7 +219,6 @@ MODULESTORE = {
'OPTIONS'
:
{
'OPTIONS'
:
{
'data_dir'
:
DATA_DIR
,
'data_dir'
:
DATA_DIR
,
'default_class'
:
'xmodule.hidden_module.HiddenDescriptor'
,
'default_class'
:
'xmodule.hidden_module.HiddenDescriptor'
,
'eager'
:
True
,
}
}
}
}
}
}
...
...
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