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
67798219
Commit
67798219
authored
Jan 12, 2015
by
Ned Batchelder
Committed by
Zia Fazal
Apr 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pylint fixes to make diff-quality happy
parent
e8c622e2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
37 deletions
+37
-37
common/lib/xmodule/xmodule/modulestore/django.py
+7
-8
common/lib/xmodule/xmodule/modulestore/mixed.py
+12
-12
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+4
-4
common/lib/xmodule/xmodule/modulestore/tests/utils.py
+8
-8
common/lib/xmodule/xmodule/modulestore/xml.py
+6
-5
No files found.
common/lib/xmodule/xmodule/modulestore/django.py
View file @
67798219
...
...
@@ -14,7 +14,6 @@ from django.core.cache import get_cache, InvalidCacheBackendError
import
django.utils
import
re
import
threading
from
xmodule.util.django
import
get_current_request_hostname
import
xmodule.modulestore
# pylint: disable=unused-import
...
...
@@ -53,13 +52,13 @@ def load_function(path):
def
create_modulestore_instance
(
engine
,
content_store
,
doc_store_config
,
options
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
engine
,
content_store
,
doc_store_config
,
options
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
):
"""
This will return a new instance of a modulestore given an engine and options
...
...
common/lib/xmodule/xmodule/modulestore/mixed.py
View file @
67798219
...
...
@@ -100,15 +100,15 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
ModuleStore knows how to route requests to the right persistence ms
"""
def
__init__
(
self
,
contentstore
,
mappings
,
stores
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
create_modulestore_instance
=
None
,
**
kwargs
self
,
contentstore
,
mappings
,
stores
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
create_modulestore_instance
=
None
,
**
kwargs
):
"""
Initialize a MixedModuleStore. Here we look into our passed in kwargs which should be a
...
...
@@ -314,7 +314,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
:param course_key: must be a CourseKey
"""
assert
(
isinstance
(
course_key
,
CourseKey
)
)
assert
isinstance
(
course_key
,
CourseKey
)
store
=
self
.
_get_modulestore_for_courseid
(
course_key
)
try
:
return
store
.
get_course
(
course_key
,
depth
=
depth
,
**
kwargs
)
...
...
@@ -351,7 +351,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
* ignore_case (bool): If True, do a case insensitive search. If
False, do a case sensitive search
"""
assert
(
isinstance
(
course_id
,
CourseKey
)
)
assert
isinstance
(
course_id
,
CourseKey
)
store
=
self
.
_get_modulestore_for_courseid
(
course_id
)
return
store
.
has_course
(
course_id
,
ignore_case
,
**
kwargs
)
...
...
@@ -359,7 +359,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
"""
See xmodule.modulestore.__init__.ModuleStoreWrite.delete_course
"""
assert
(
isinstance
(
course_key
,
CourseKey
)
)
assert
isinstance
(
course_key
,
CourseKey
)
store
=
self
.
_get_modulestore_for_courseid
(
course_key
)
return
store
.
delete_course
(
course_key
,
user_id
)
...
...
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
67798219
...
...
@@ -282,7 +282,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
# decache any computed pending field settings
module
.
save
()
return
module
except
:
except
Exception
:
# pylint: disable=broad-except
log
.
warning
(
"Failed to load descriptor from
%
s"
,
json_data
,
exc_info
=
True
)
return
ErrorDescriptor
.
from_json
(
json_data
,
...
...
@@ -942,7 +942,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
"""
Get the course with the given courseid (org/course/run)
"""
assert
(
isinstance
(
course_key
,
CourseKey
)
)
assert
isinstance
(
course_key
,
CourseKey
)
course_key
=
self
.
fill_in_run
(
course_key
)
location
=
course_key
.
make_usage_key
(
'course'
,
course_key
.
run
)
try
:
...
...
@@ -959,7 +959,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
If ignore_case is True, do a case insensitive search,
otherwise, do a case sensitive search
"""
assert
(
isinstance
(
course_key
,
CourseKey
)
)
assert
isinstance
(
course_key
,
CourseKey
)
if
isinstance
(
course_key
,
LibraryLocator
):
return
None
# Libraries require split mongo
course_key
=
self
.
fill_in_run
(
course_key
)
...
...
@@ -1615,7 +1615,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
elif
isinstance
(
course_assets
[
'assets'
],
list
):
# This record is in the old course assets format.
# Ensure that no data exists before updating the format.
assert
(
len
(
course_assets
[
'assets'
])
==
0
)
assert
len
(
course_assets
[
'assets'
])
==
0
# Update the format to a dict.
self
.
asset_collection
.
update
(
{
'_id'
:
doc_id
},
...
...
common/lib/xmodule/xmodule/modulestore/tests/utils.py
View file @
67798219
...
...
@@ -28,13 +28,13 @@ def load_function(path):
# pylint: disable=unused-argument
def
create_modulestore_instance
(
engine
,
contentstore
,
doc_store_config
,
options
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
engine
,
contentstore
,
doc_store_config
,
options
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
):
"""
This will return a new instance of a modulestore given an engine and options
...
...
@@ -77,7 +77,7 @@ class MixedSplitTestCase(TestCase):
Stripped-down version of ModuleStoreTestCase that can be used without Django
(i.e. for testing in common/lib/ ). Sets up MixedModuleStore and Split.
"""
RENDER_TEMPLATE
=
lambda
t_n
,
d
,
ctx
=
None
,
nsp
=
'main'
:
u'{}: {}, {}'
.
format
(
t_n
,
repr
(
d
),
repr
(
ctx
))
RENDER_TEMPLATE
=
lambda
t_n
,
d
,
ctx
=
None
,
nsp
=
'main'
:
u'{}: {}, {}'
.
format
(
t_n
,
repr
(
d
),
repr
(
ctx
))
modulestore_options
=
{
'default_class'
:
'xmodule.raw_module.RawDescriptor'
,
'fs_root'
:
DATA_DIR
,
...
...
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
67798219
...
...
@@ -64,7 +64,8 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
self
.
unnamed
=
defaultdict
(
int
)
# category -> num of new url_names for that category
self
.
used_names
=
defaultdict
(
set
)
# category -> set of used url_names
# cdodge: adding the course_id as passed in for later reference rather than having to recomine the org/course/url_name
# Adding the course_id as passed in for later reference rather than
# having to recombine the org/course/url_name
self
.
course_id
=
course_id
self
.
load_error_modules
=
load_error_modules
self
.
modulestore
=
xmlstore
...
...
@@ -292,8 +293,8 @@ class XMLModuleStore(ModuleStoreReadBase):
An XML backed ModuleStore
"""
def
__init__
(
self
,
data_dir
,
default_class
=
None
,
course_dirs
=
None
,
course_ids
=
None
,
load_error_modules
=
True
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
**
kwargs
self
,
data_dir
,
default_class
=
None
,
course_dirs
=
None
,
course_ids
=
None
,
load_error_modules
=
True
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
**
kwargs
):
"""
Initialize an XMLModuleStore from data_dir
...
...
@@ -304,8 +305,8 @@ class XMLModuleStore(ModuleStoreReadBase):
default_class (str): dot-separated string defining the default descriptor
class to use if none is specified in entry_points
course_dirs or course_ids (list of str): If specified, the list of course_dirs or course_ids to load.
Otherwise,
load all courses. Note, providing both
course_dirs or course_ids (list of str): If specified, the list of course_dirs or course_ids to load.
Otherwise,
load all courses. Note, providing both
"""
super
(
XMLModuleStore
,
self
)
.
__init__
(
**
kwargs
)
...
...
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