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
74d7b2a7
Commit
74d7b2a7
authored
Jul 29, 2015
by
Davorin Sego
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a different take
parent
a2dbd403
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
30 deletions
+18
-30
common/lib/xmodule/xmodule/modulestore/__init__.py
+2
-28
common/lib/xmodule/xmodule/modulestore/django.py
+11
-0
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+2
-1
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+3
-1
No files found.
common/lib/xmodule/xmodule/modulestore/__init__.py
View file @
74d7b2a7
...
@@ -23,6 +23,7 @@ from xblock.plugin import default_select
...
@@ -23,6 +23,7 @@ from xblock.plugin import default_select
from
.exceptions
import
InvalidLocationError
,
InsufficientSpecificationError
from
.exceptions
import
InvalidLocationError
,
InsufficientSpecificationError
from
xmodule.errortracker
import
make_error_tracker
from
xmodule.errortracker
import
make_error_tracker
from
xmodule.assetstore
import
AssetMetadata
from
xmodule.assetstore
import
AssetMetadata
from
xmodule.modulestore.django
import
NullSignalHandler
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
,
AssetKey
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
,
AssetKey
from
opaque_keys.edx.locations
import
Location
# For import backwards compatibility
from
opaque_keys.edx.locations
import
Location
# For import backwards compatibility
from
xblock.runtime
import
Mixologist
from
xblock.runtime
import
Mixologist
...
@@ -154,17 +155,6 @@ class ActiveBulkThread(threading.local):
...
@@ -154,17 +155,6 @@ class ActiveBulkThread(threading.local):
self
.
records
=
defaultdict
(
bulk_ops_record_type
)
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
):
class
BulkOperationsMixin
(
object
):
"""
"""
This implements the :meth:`bulk_operations` modulestore semantics which handles nested invocations
This implements the :meth:`bulk_operations` modulestore semantics which handles nested invocations
...
@@ -180,23 +170,7 @@ class BulkOperationsMixin(object):
...
@@ -180,23 +170,7 @@ class BulkOperationsMixin(object):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
BulkOperationsMixin
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
BulkOperationsMixin
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
_active_bulk_ops
=
ActiveBulkThread
(
self
.
_bulk_ops_record_type
)
self
.
_active_bulk_ops
=
ActiveBulkThread
(
self
.
_bulk_ops_record_type
)
self
.
_signal_handler
=
None
self
.
signal_handler
=
NullSignalHandler
()
@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
@contextmanager
def
bulk_operations
(
self
,
course_id
,
emit_signals
=
True
):
def
bulk_operations
(
self
,
course_id
,
emit_signals
=
True
):
...
...
common/lib/xmodule/xmodule/modulestore/django.py
View file @
74d7b2a7
...
@@ -110,6 +110,17 @@ class SignalHandler(object):
...
@@ -110,6 +110,17 @@ class SignalHandler(object):
log
.
info
(
'Sent
%
s signal to
%
s with kwargs
%
s. Response was:
%
s'
,
signal_name
,
receiver
,
kwargs
,
response
)
log
.
info
(
'Sent
%
s signal to
%
s with kwargs
%
s. Response was:
%
s'
,
signal_name
,
receiver
,
kwargs
,
response
)
class
NullSignalHandler
(
object
):
"""
A null handler that does nothing
"""
def
send
(
self
,
*
args
,
**
kwargs
):
"""
No-op
"""
pass
def
load_function
(
path
):
def
load_function
(
path
):
"""
"""
Load a function by name.
Load a function by name.
...
...
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
74d7b2a7
...
@@ -49,6 +49,7 @@ from xmodule.modulestore.edit_info import EditInfoRuntimeMixin
...
@@ -49,6 +49,7 @@ from xmodule.modulestore.edit_info import EditInfoRuntimeMixin
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
DuplicateCourseError
,
ReferentialIntegrityError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
DuplicateCourseError
,
ReferentialIntegrityError
from
xmodule.modulestore.inheritance
import
InheritanceMixin
,
inherit_metadata
,
InheritanceKeyValueStore
from
xmodule.modulestore.inheritance
import
InheritanceMixin
,
inherit_metadata
,
InheritanceKeyValueStore
from
xmodule.modulestore.xml
import
CourseLocationManager
from
xmodule.modulestore.xml
import
CourseLocationManager
from
xmodule.modulestore.django
import
NullSignalHandler
from
xmodule.services
import
SettingsService
from
xmodule.services
import
SettingsService
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -543,7 +544,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
...
@@ -543,7 +544,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
i18n_service
=
None
,
i18n_service
=
None
,
fs_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
user_service
=
None
,
signal_handler
=
N
one
,
signal_handler
=
N
ullSignalHandler
()
,
retry_wait_time
=
0.1
,
retry_wait_time
=
0.1
,
**
kwargs
):
**
kwargs
):
"""
"""
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
74d7b2a7
...
@@ -85,6 +85,7 @@ from xmodule.error_module import ErrorDescriptor
...
@@ -85,6 +85,7 @@ from xmodule.error_module import ErrorDescriptor
from
collections
import
defaultdict
from
collections
import
defaultdict
from
types
import
NoneType
from
types
import
NoneType
from
xmodule.assetstore
import
AssetMetadata
from
xmodule.assetstore
import
AssetMetadata
from
xmodule.modulestore.django
import
NullSignalHandler
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -640,7 +641,8 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
...
@@ -640,7 +641,8 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
default_class
=
None
,
default_class
=
None
,
error_tracker
=
null_error_tracker
,
error_tracker
=
null_error_tracker
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
i18n_service
=
None
,
fs_service
=
None
,
user_service
=
None
,
services
=
None
,
signal_handler
=
None
,
**
kwargs
):
services
=
None
,
signal_handler
=
NullSignalHandler
(),
**
kwargs
):
"""
"""
:param doc_store_config: must have a host, db, and collection entries. Other common entries: port, tz_aware.
:param doc_store_config: must have a host, db, and collection entries. Other common entries: port, tz_aware.
"""
"""
...
...
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