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
...
@@ -14,7 +14,6 @@ from django.core.cache import get_cache, InvalidCacheBackendError
import
django.utils
import
django.utils
import
re
import
re
import
threading
from
xmodule.util.django
import
get_current_request_hostname
from
xmodule.util.django
import
get_current_request_hostname
import
xmodule.modulestore
# pylint: disable=unused-import
import
xmodule.modulestore
# pylint: disable=unused-import
...
@@ -53,13 +52,13 @@ def load_function(path):
...
@@ -53,13 +52,13 @@ def load_function(path):
def
create_modulestore_instance
(
def
create_modulestore_instance
(
engine
,
engine
,
content_store
,
content_store
,
doc_store_config
,
doc_store_config
,
options
,
options
,
i18n_service
=
None
,
i18n_service
=
None
,
fs_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
user_service
=
None
,
):
):
"""
"""
This will return a new instance of a modulestore given an engine and options
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):
...
@@ -100,15 +100,15 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
ModuleStore knows how to route requests to the right persistence ms
ModuleStore knows how to route requests to the right persistence ms
"""
"""
def
__init__
(
def
__init__
(
self
,
self
,
contentstore
,
contentstore
,
mappings
,
mappings
,
stores
,
stores
,
i18n_service
=
None
,
i18n_service
=
None
,
fs_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
user_service
=
None
,
create_modulestore_instance
=
None
,
create_modulestore_instance
=
None
,
**
kwargs
**
kwargs
):
):
"""
"""
Initialize a MixedModuleStore. Here we look into our passed in kwargs which should be a
Initialize a MixedModuleStore. Here we look into our passed in kwargs which should be a
...
@@ -314,7 +314,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
...
@@ -314,7 +314,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
:param course_key: must be a CourseKey
: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
)
store
=
self
.
_get_modulestore_for_courseid
(
course_key
)
try
:
try
:
return
store
.
get_course
(
course_key
,
depth
=
depth
,
**
kwargs
)
return
store
.
get_course
(
course_key
,
depth
=
depth
,
**
kwargs
)
...
@@ -351,7 +351,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
...
@@ -351,7 +351,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
* ignore_case (bool): If True, do a case insensitive search. If
* ignore_case (bool): If True, do a case insensitive search. If
False, do a case sensitive search
False, do a case sensitive search
"""
"""
assert
(
isinstance
(
course_id
,
CourseKey
)
)
assert
isinstance
(
course_id
,
CourseKey
)
store
=
self
.
_get_modulestore_for_courseid
(
course_id
)
store
=
self
.
_get_modulestore_for_courseid
(
course_id
)
return
store
.
has_course
(
course_id
,
ignore_case
,
**
kwargs
)
return
store
.
has_course
(
course_id
,
ignore_case
,
**
kwargs
)
...
@@ -359,7 +359,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
...
@@ -359,7 +359,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
"""
"""
See xmodule.modulestore.__init__.ModuleStoreWrite.delete_course
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
)
store
=
self
.
_get_modulestore_for_courseid
(
course_key
)
return
store
.
delete_course
(
course_key
,
user_id
)
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):
...
@@ -282,7 +282,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
# decache any computed pending field settings
# decache any computed pending field settings
module
.
save
()
module
.
save
()
return
module
return
module
except
:
except
Exception
:
# pylint: disable=broad-except
log
.
warning
(
"Failed to load descriptor from
%
s"
,
json_data
,
exc_info
=
True
)
log
.
warning
(
"Failed to load descriptor from
%
s"
,
json_data
,
exc_info
=
True
)
return
ErrorDescriptor
.
from_json
(
return
ErrorDescriptor
.
from_json
(
json_data
,
json_data
,
...
@@ -942,7 +942,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
...
@@ -942,7 +942,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
"""
"""
Get the course with the given courseid (org/course/run)
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
)
course_key
=
self
.
fill_in_run
(
course_key
)
location
=
course_key
.
make_usage_key
(
'course'
,
course_key
.
run
)
location
=
course_key
.
make_usage_key
(
'course'
,
course_key
.
run
)
try
:
try
:
...
@@ -959,7 +959,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
...
@@ -959,7 +959,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
If ignore_case is True, do a case insensitive search,
If ignore_case is True, do a case insensitive search,
otherwise, do a case sensitive search
otherwise, do a case sensitive search
"""
"""
assert
(
isinstance
(
course_key
,
CourseKey
)
)
assert
isinstance
(
course_key
,
CourseKey
)
if
isinstance
(
course_key
,
LibraryLocator
):
if
isinstance
(
course_key
,
LibraryLocator
):
return
None
# Libraries require split mongo
return
None
# Libraries require split mongo
course_key
=
self
.
fill_in_run
(
course_key
)
course_key
=
self
.
fill_in_run
(
course_key
)
...
@@ -1615,7 +1615,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
...
@@ -1615,7 +1615,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
elif
isinstance
(
course_assets
[
'assets'
],
list
):
elif
isinstance
(
course_assets
[
'assets'
],
list
):
# This record is in the old course assets format.
# This record is in the old course assets format.
# Ensure that no data exists before updating the 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.
# Update the format to a dict.
self
.
asset_collection
.
update
(
self
.
asset_collection
.
update
(
{
'_id'
:
doc_id
},
{
'_id'
:
doc_id
},
...
...
common/lib/xmodule/xmodule/modulestore/tests/utils.py
View file @
67798219
...
@@ -28,13 +28,13 @@ def load_function(path):
...
@@ -28,13 +28,13 @@ def load_function(path):
# pylint: disable=unused-argument
# pylint: disable=unused-argument
def
create_modulestore_instance
(
def
create_modulestore_instance
(
engine
,
engine
,
contentstore
,
contentstore
,
doc_store_config
,
doc_store_config
,
options
,
options
,
i18n_service
=
None
,
i18n_service
=
None
,
fs_service
=
None
,
fs_service
=
None
,
user_service
=
None
user_service
=
None
):
):
"""
"""
This will return a new instance of a modulestore given an engine and options
This will return a new instance of a modulestore given an engine and options
...
@@ -77,7 +77,7 @@ class MixedSplitTestCase(TestCase):
...
@@ -77,7 +77,7 @@ class MixedSplitTestCase(TestCase):
Stripped-down version of ModuleStoreTestCase that can be used without Django
Stripped-down version of ModuleStoreTestCase that can be used without Django
(i.e. for testing in common/lib/ ). Sets up MixedModuleStore and Split.
(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
=
{
modulestore_options
=
{
'default_class'
:
'xmodule.raw_module.RawDescriptor'
,
'default_class'
:
'xmodule.raw_module.RawDescriptor'
,
'fs_root'
:
DATA_DIR
,
'fs_root'
:
DATA_DIR
,
...
...
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
67798219
...
@@ -64,7 +64,8 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
...
@@ -64,7 +64,8 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
self
.
unnamed
=
defaultdict
(
int
)
# category -> num of new url_names for that category
self
.
unnamed
=
defaultdict
(
int
)
# category -> num of new url_names for that category
self
.
used_names
=
defaultdict
(
set
)
# category -> set of used url_names
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
.
course_id
=
course_id
self
.
load_error_modules
=
load_error_modules
self
.
load_error_modules
=
load_error_modules
self
.
modulestore
=
xmlstore
self
.
modulestore
=
xmlstore
...
@@ -292,8 +293,8 @@ class XMLModuleStore(ModuleStoreReadBase):
...
@@ -292,8 +293,8 @@ class XMLModuleStore(ModuleStoreReadBase):
An XML backed ModuleStore
An XML backed ModuleStore
"""
"""
def
__init__
(
def
__init__
(
self
,
data_dir
,
default_class
=
None
,
course_dirs
=
None
,
course_ids
=
None
,
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
load_error_modules
=
True
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
**
kwargs
):
):
"""
"""
Initialize an XMLModuleStore from data_dir
Initialize an XMLModuleStore from data_dir
...
@@ -304,8 +305,8 @@ class XMLModuleStore(ModuleStoreReadBase):
...
@@ -304,8 +305,8 @@ class XMLModuleStore(ModuleStoreReadBase):
default_class (str): dot-separated string defining the default descriptor
default_class (str): 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
course_dirs or course_ids (list of str): If specified, the list of course_dirs or course_ids to load.
Otherwise,
course_dirs or course_ids (list of str): If specified, the list of course_dirs or course_ids to load.
load all courses. Note, providing both
Otherwise,
load all courses. Note, providing both
"""
"""
super
(
XMLModuleStore
,
self
)
.
__init__
(
**
kwargs
)
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