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
ab923ea2
Commit
ab923ea2
authored
Jul 29, 2015
by
Davorin Sego
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a universal null handler
parent
dd457c2f
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
34 deletions
+21
-34
common/lib/xmodule/xmodule/modulestore/__init__.py
+0
-28
common/lib/xmodule/xmodule/modulestore/django.py
+2
-1
common/lib/xmodule/xmodule/modulestore/mixed.py
+2
-1
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+2
-1
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+2
-1
common/lib/xmodule/xmodule/modulestore/tests/utils.py
+2
-1
common/lib/xmodule/xmodule/modulestore/xml.py
+2
-1
common/lib/xmodule/xmodule/util/null_handler.py
+9
-0
No files found.
common/lib/xmodule/xmodule/modulestore/__init__.py
View file @
ab923ea2
...
...
@@ -154,17 +154,6 @@ class ActiveBulkThread(threading.local):
self
.
records
=
defaultdict
(
bulk_ops_record_type
)
class
NullSignalHandler
(
object
):
"""
A null handler that does nothing
"""
def
send
(
self
,
*
args
,
**
kwargs
):
"""
No-op
"""
pass
class
BulkOperationsMixin
(
object
):
"""
This implements the :meth:`bulk_operations` modulestore semantics which handles nested invocations
...
...
@@ -180,23 +169,6 @@ class BulkOperationsMixin(object):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
BulkOperationsMixin
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
_active_bulk_ops
=
ActiveBulkThread
(
self
.
_bulk_ops_record_type
)
self
.
_signal_handler
=
None
@property
def
signal_handler
(
self
):
"""
Return a signal handler, defaults to a null handler that does nothing.
"""
if
not
self
.
_signal_handler
:
self
.
_signal_handler
=
NullSignalHandler
()
return
self
.
_signal_handler
@signal_handler.setter
def
signal_handler
(
self
,
value
):
"""
Set the signal handler
"""
self
.
_signal_handler
=
value
@contextmanager
def
bulk_operations
(
self
,
course_id
,
emit_signals
=
True
):
...
...
common/lib/xmodule/xmodule/modulestore/django.py
View file @
ab923ea2
...
...
@@ -26,6 +26,7 @@ from xmodule.contentstore.django import contentstore
from
xmodule.modulestore.draft_and_published
import
BranchSettingMixin
from
xmodule.modulestore.mixed
import
MixedModuleStore
from
xmodule.util.django
import
get_current_request_hostname
from
xmodule.util.null_handler
import
NullHandler
import
xblock.reference.plugins
...
...
@@ -129,7 +130,7 @@ def create_modulestore_instance(
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
signal_handler
=
N
one
,
signal_handler
=
N
ullHandler
()
,
):
"""
This will return a new instance of a modulestore given an engine and options
...
...
common/lib/xmodule/xmodule/modulestore/mixed.py
View file @
ab923ea2
...
...
@@ -16,6 +16,7 @@ from opaque_keys.edx.keys import CourseKey, AssetKey
from
opaque_keys.edx.locator
import
LibraryLocator
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.assetstore
import
AssetMetadata
from
xmodule.util.null_handler
import
NullHandler
from
.
import
ModuleStoreWriteBase
from
.
import
ModuleStoreEnum
...
...
@@ -108,7 +109,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
fs_service
=
None
,
user_service
=
None
,
create_modulestore_instance
=
None
,
signal_handler
=
N
one
,
signal_handler
=
N
ullHandler
()
,
**
kwargs
):
"""
...
...
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
ab923ea2
...
...
@@ -50,6 +50,7 @@ from xmodule.modulestore.exceptions import ItemNotFoundError, DuplicateCourseErr
from
xmodule.modulestore.inheritance
import
InheritanceMixin
,
inherit_metadata
,
InheritanceKeyValueStore
from
xmodule.modulestore.xml
import
CourseLocationManager
from
xmodule.services
import
SettingsService
from
xmodule.util.null_handler
import
NullHandler
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -543,7 +544,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
signal_handler
=
N
one
,
signal_handler
=
N
ullHandler
()
,
retry_wait_time
=
0.1
,
**
kwargs
):
"""
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
ab923ea2
...
...
@@ -67,6 +67,7 @@ from bson.objectid import ObjectId
from
xblock.core
import
XBlock
from
xblock.fields
import
Scope
,
Reference
,
ReferenceList
,
ReferenceValueDict
from
xmodule.errortracker
import
null_error_tracker
from
xmodule.util.null_handler
import
NullHandler
from
opaque_keys.edx.locator
import
(
BlockUsageLocator
,
DefinitionLocator
,
CourseLocator
,
LibraryLocator
,
VersionTree
,
LocalId
,
)
...
...
@@ -640,7 +641,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
default_class
=
None
,
error_tracker
=
null_error_tracker
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
services
=
None
,
signal_handler
=
N
one
,
**
kwargs
):
services
=
None
,
signal_handler
=
N
ullHandler
()
,
**
kwargs
):
"""
:param doc_store_config: must have a host, db, and collection entries. Other common entries: port, tz_aware.
"""
...
...
common/lib/xmodule/xmodule/modulestore/tests/utils.py
View file @
ab923ea2
...
...
@@ -6,6 +6,7 @@ from opaque_keys.edx.keys import UsageKey
from
unittest
import
TestCase
from
xblock.fields
import
XBlockMixin
from
xmodule.x_module
import
XModuleMixin
from
xmodule.util.null_handler
import
NullHandler
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.draft_and_published
import
ModuleStoreDraftAndPublished
from
xmodule.modulestore.edit_info
import
EditInfoMixin
...
...
@@ -36,7 +37,7 @@ def create_modulestore_instance(
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
signal_handler
=
N
one
,
signal_handler
=
N
ullHandler
()
,
):
"""
This will return a new instance of a modulestore given an engine and options
...
...
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
ab923ea2
...
...
@@ -26,6 +26,7 @@ from xmodule.x_module import (
from
xmodule.modulestore.xml_exporter
import
DEFAULT_CONTENT_FIELDS
from
xmodule.modulestore
import
ModuleStoreEnum
,
ModuleStoreReadBase
,
LIBRARY_ROOT
,
COURSE_ROOT
from
xmodule.tabs
import
CourseTabList
from
xmodule.util.null_handler
import
NullHandler
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
Location
from
opaque_keys.edx.locator
import
CourseLocator
,
LibraryLocator
...
...
@@ -335,7 +336,7 @@ class XMLModuleStore(ModuleStoreReadBase):
def
__init__
(
self
,
data_dir
,
default_class
=
None
,
source_dirs
=
None
,
course_ids
=
None
,
load_error_modules
=
True
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
signal_handler
=
N
one
,
target_course_id
=
None
,
**
kwargs
# pylint: disable=unused-argument
signal_handler
=
N
ullHandler
()
,
target_course_id
=
None
,
**
kwargs
# pylint: disable=unused-argument
):
"""
Initialize an XMLModuleStore from data_dir
...
...
common/lib/xmodule/xmodule/util/null_handler.py
0 → 100644
View file @
ab923ea2
class
NullHandler
(
object
):
"""
Responds to an any method call.
"""
def
__getattr__
(
self
,
name
):
def
method
(
*
args
,
**
kwargs
):
pass
return
method
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