Commit a0675a16 by John Eskew

Merge pull request #8281 from edx/release

Merging hotfix-2015-05-29 from release to master
parents acbc2113 3d878240
......@@ -26,6 +26,10 @@ class MongoContentStore(ContentStore):
: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))
# Remove the replicaSet parameter.
kwargs.pop('replicaSet', None)
_db = pymongo.database.Database(
pymongo.MongoClient(
host=host,
......
......@@ -20,6 +20,8 @@ if not settings.configured:
from django.core.cache import get_cache, InvalidCacheBackendError
import django.dispatch
import django.utils
from pymongo import ReadPreference
from xmodule.contentstore.django import contentstore
from xmodule.modulestore.draft_and_published import BranchSettingMixin
from xmodule.modulestore.mixed import MixedModuleStore
......@@ -156,6 +158,9 @@ def create_modulestore_instance(
else:
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_(
contentstore=content_store,
metadata_inheritance_cache_subsystem=metadata_inheritance_cache,
......
......@@ -552,6 +552,9 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
"""
Create & open the connection, authenticate, and provide pointers to the collection
"""
# Remove the replicaSet parameter.
kwargs.pop('replicaSet', None)
self.database = MongoProxy(
pymongo.database.Database(
pymongo.MongoClient(
......
......@@ -81,16 +81,19 @@ class MongoConnection(object):
"""
Create & open the connection, authenticate, and provide pointers to the collections
"""
self.database = MongoProxy(
pymongo.database.Database(
pymongo.MongoClient(
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
),
db
),
)
self.database = MongoProxy(
pymongo.database.Database(_client, db),
wait_time=retry_wait_time
)
......
......@@ -908,6 +908,13 @@ def _invoke_xblock_handler(request, course_id, usage_id, handler, suffix):
if error_msg:
return JsonResponse(object={'success': error_msg}, status=413)
# 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
with modulestore().bulk_operations(course_key):
instance, tracking_context = get_module_by_usage_id(request, course_id, usage_id)
# Name the transaction so that we can view XBlock handlers separately in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment