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
3d878240
Commit
3d878240
authored
May 29, 2015
by
John Eskew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8276 from edx/hotfix/2015-05-29
Hotfix/2015 05 29
parents
b5c6eb78
c33c782f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
37 deletions
+59
-37
common/lib/xmodule/xmodule/contentstore/mongo.py
+4
-0
common/lib/xmodule/xmodule/modulestore/django.py
+5
-0
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+3
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
+12
-9
lms/djangoapps/courseware/module_render.py
+35
-28
No files found.
common/lib/xmodule/xmodule/contentstore/mongo.py
View file @
3d878240
...
@@ -26,6 +26,10 @@ class MongoContentStore(ContentStore):
...
@@ -26,6 +26,10 @@ class MongoContentStore(ContentStore):
:param collection: ignores but provided for consistency w/ other doc_store_config patterns
:param collection: ignores but provided for consistency w/ other doc_store_config patterns
"""
"""
logging
.
debug
(
'Using MongoDB for static content serving at host={0} port={1} db={2}'
.
format
(
host
,
port
,
db
))
logging
.
debug
(
'Using MongoDB for static content serving at host={0} port={1} db={2}'
.
format
(
host
,
port
,
db
))
# Remove the replicaSet parameter.
kwargs
.
pop
(
'replicaSet'
,
None
)
_db
=
pymongo
.
database
.
Database
(
_db
=
pymongo
.
database
.
Database
(
pymongo
.
MongoClient
(
pymongo
.
MongoClient
(
host
=
host
,
host
=
host
,
...
...
common/lib/xmodule/xmodule/modulestore/django.py
View file @
3d878240
...
@@ -20,6 +20,8 @@ if not settings.configured:
...
@@ -20,6 +20,8 @@ if not settings.configured:
from
django.core.cache
import
get_cache
,
InvalidCacheBackendError
from
django.core.cache
import
get_cache
,
InvalidCacheBackendError
import
django.dispatch
import
django.dispatch
import
django.utils
import
django.utils
from
pymongo
import
ReadPreference
from
xmodule.contentstore.django
import
contentstore
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore.draft_and_published
import
BranchSettingMixin
from
xmodule.modulestore.draft_and_published
import
BranchSettingMixin
from
xmodule.modulestore.mixed
import
MixedModuleStore
from
xmodule.modulestore.mixed
import
MixedModuleStore
...
@@ -156,6 +158,9 @@ def create_modulestore_instance(
...
@@ -156,6 +158,9 @@ def create_modulestore_instance(
else
:
else
:
xb_user_service
=
None
xb_user_service
=
None
if
'read_preference'
in
doc_store_config
:
doc_store_config
[
'read_preference'
]
=
getattr
(
ReadPreference
,
doc_store_config
[
'read_preference'
])
return
class_
(
return
class_
(
contentstore
=
content_store
,
contentstore
=
content_store
,
metadata_inheritance_cache_subsystem
=
metadata_inheritance_cache
,
metadata_inheritance_cache_subsystem
=
metadata_inheritance_cache
,
...
...
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
3d878240
...
@@ -552,6 +552,9 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
...
@@ -552,6 +552,9 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
"""
"""
Create & open the connection, authenticate, and provide pointers to the collection
Create & open the connection, authenticate, and provide pointers to the collection
"""
"""
# Remove the replicaSet parameter.
kwargs
.
pop
(
'replicaSet'
,
None
)
self
.
database
=
MongoProxy
(
self
.
database
=
MongoProxy
(
pymongo
.
database
.
Database
(
pymongo
.
database
.
Database
(
pymongo
.
MongoClient
(
pymongo
.
MongoClient
(
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
View file @
3d878240
...
@@ -81,16 +81,19 @@ class MongoConnection(object):
...
@@ -81,16 +81,19 @@ class MongoConnection(object):
"""
"""
Create & open the connection, authenticate, and provide pointers to the collections
Create & open the connection, authenticate, and provide pointers to the collections
"""
"""
if
kwargs
.
get
(
'replicaSet'
)
is
None
:
kwargs
.
pop
(
'replicaSet'
,
None
)
mongo_class
=
pymongo
.
MongoClient
else
:
mongo_class
=
pymongo
.
MongoReplicaSetClient
_client
=
mongo_class
(
host
=
host
,
port
=
port
,
tz_aware
=
tz_aware
,
**
kwargs
)
self
.
database
=
MongoProxy
(
self
.
database
=
MongoProxy
(
pymongo
.
database
.
Database
(
pymongo
.
database
.
Database
(
_client
,
db
),
pymongo
.
MongoClient
(
host
=
host
,
port
=
port
,
tz_aware
=
tz_aware
,
**
kwargs
),
db
),
wait_time
=
retry_wait_time
wait_time
=
retry_wait_time
)
)
...
...
lms/djangoapps/courseware/module_render.py
View file @
3d878240
...
@@ -908,40 +908,47 @@ def _invoke_xblock_handler(request, course_id, usage_id, handler, suffix):
...
@@ -908,40 +908,47 @@ def _invoke_xblock_handler(request, course_id, usage_id, handler, suffix):
if
error_msg
:
if
error_msg
:
return
JsonResponse
(
object
=
{
'success'
:
error_msg
},
status
=
413
)
return
JsonResponse
(
object
=
{
'success'
:
error_msg
},
status
=
413
)
instance
,
tracking_context
=
get_module_by_usage_id
(
request
,
course_id
,
usage_id
)
# Make a CourseKey from the course_id, raising a 404 upon parse error.
try
:
course_key
=
CourseKey
.
from_string
(
course_id
)
except
InvalidKeyError
:
raise
Http404
# Name the transaction so that we can view XBlock handlers separately in
with
modulestore
()
.
bulk_operations
(
course_key
):
# New Relic. The suffix is necessary for XModule handlers because the
instance
,
tracking_context
=
get_module_by_usage_id
(
request
,
course_id
,
usage_id
)
# "handler" in those cases is always just "xmodule_handler".
nr_tx_name
=
"{}.{}"
.
format
(
instance
.
__class__
.
__name__
,
handler
)
nr_tx_name
+=
"/{}"
.
format
(
suffix
)
if
suffix
else
""
newrelic
.
agent
.
set_transaction_name
(
nr_tx_name
,
group
=
"Python/XBlock/Handler"
)
tracking_context_name
=
'module_callback_handler'
# Name the transaction so that we can view XBlock handlers separately in
req
=
django_to_webob_request
(
request
)
# New Relic. The suffix is necessary for XModule handlers because the
try
:
# "handler" in those cases is always just "xmodule_handler".
with
tracker
.
get_tracker
()
.
context
(
tracking_context_name
,
tracking_context
):
nr_tx_name
=
"{}.{}"
.
format
(
instance
.
__class__
.
__name__
,
handler
)
resp
=
instance
.
handle
(
handler
,
req
,
suffix
)
nr_tx_name
+=
"/{}"
.
format
(
suffix
)
if
suffix
else
""
newrelic
.
agent
.
set_transaction_name
(
nr_tx_name
,
group
=
"Python/XBlock/Handler"
)
except
NoSuchHandlerError
:
tracking_context_name
=
'module_callback_handler'
log
.
exception
(
"XBlock
%
s attempted to access missing handler
%
r"
,
instance
,
handler
)
req
=
django_to_webob_request
(
request
)
raise
Http404
try
:
with
tracker
.
get_tracker
()
.
context
(
tracking_context_name
,
tracking_context
):
resp
=
instance
.
handle
(
handler
,
req
,
suffix
)
# If we can't find the module, respond with a 404
except
NoSuchHandlerError
:
except
NotFoundError
:
log
.
exception
(
"XBlock
%
s attempted to access missing handler
%
r"
,
instance
,
handler
)
log
.
exception
(
"Module indicating to user that request doesn't exist"
)
raise
Http404
raise
Http404
# For XModule-specific errors, we log the error and respond with an error message
# If we can't find the module, respond with a 404
except
ProcessingError
as
err
:
except
NotFoundError
:
log
.
warning
(
"Module encountered an error while processing AJAX call"
,
log
.
exception
(
"Module indicating to user that request doesn't exist"
)
exc_info
=
True
)
raise
Http404
return
JsonResponse
(
object
=
{
'success'
:
err
.
args
[
0
]},
status
=
200
)
# If any other error occurred, re-raise it to trigger a 500 response
# For XModule-specific errors, we log the error and respond with an error message
except
Exception
:
except
ProcessingError
as
err
:
log
.
exception
(
"error executing xblock handler"
)
log
.
warning
(
"Module encountered an error while processing AJAX call"
,
raise
exc_info
=
True
)
return
JsonResponse
(
object
=
{
'success'
:
err
.
args
[
0
]},
status
=
200
)
# If any other error occurred, re-raise it to trigger a 500 response
except
Exception
:
log
.
exception
(
"error executing xblock handler"
)
raise
return
webob_to_django_response
(
resp
)
return
webob_to_django_response
(
resp
)
...
...
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