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
ca0dd839
Commit
ca0dd839
authored
Feb 24, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mixed no longer translates
parent
432249e9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
56 additions
and
35 deletions
+56
-35
cms/djangoapps/contentstore/tests/test_export_git.py
+3
-2
cms/djangoapps/contentstore/views/item.py
+6
-1
cms/envs/bok_choy.py
+1
-1
common/lib/xmodule/xmodule/modulestore/__init__.py
+3
-1
common/lib/xmodule/xmodule/modulestore/locator.py
+31
-18
common/lib/xmodule/xmodule/modulestore/mixed.py
+0
-0
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+1
-2
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+2
-2
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+2
-2
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
+4
-2
common/lib/xmodule/xmodule/modulestore/tests/test_locators.py
+3
-2
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+0
-0
lms/envs/acceptance.py
+0
-1
lms/envs/cms/dev.py
+0
-1
No files found.
cms/djangoapps/contentstore/tests/test_export_git.py
View file @
ca0dd839
...
...
@@ -17,6 +17,7 @@ from .utils import CourseTestCase
import
contentstore.git_export_utils
as
git_export_utils
from
xmodule.contentstore.django
import
_CONTENTSTORE
from
xmodule.modulestore.django
import
modulestore
from
contentstore.utils
import
get_modulestore
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
...
...
@@ -70,7 +71,7 @@ class TestExportGit(CourseTestCase):
Test failed course export response.
"""
self
.
course_module
.
giturl
=
'foobar'
modulestore
()
.
save_xmodule
(
self
.
course_module
)
get_modulestore
(
self
.
course_module
.
location
)
.
update_item
(
self
.
course_module
)
response
=
self
.
client
.
get
(
'{}?action=push'
.
format
(
self
.
test_url
))
self
.
assertIn
(
'Export Failed:'
,
response
.
content
)
...
...
@@ -93,7 +94,7 @@ class TestExportGit(CourseTestCase):
self
.
populateCourse
()
self
.
course_module
.
giturl
=
'file://{}'
.
format
(
bare_repo_dir
)
modulestore
()
.
save_xmodule
(
self
.
course_module
)
get_modulestore
(
self
.
course_module
.
location
)
.
update_item
(
self
.
course_module
)
response
=
self
.
client
.
get
(
'{}?action=push'
.
format
(
self
.
test_url
))
self
.
assertIn
(
'Export Succeeded'
,
response
.
content
)
cms/djangoapps/contentstore/views/item.py
View file @
ca0dd839
...
...
@@ -202,7 +202,12 @@ def xblock_view_handler(request, package_id, view_name, tag=None, branch=None, v
log
.
debug
(
"unable to render studio_view for
%
r"
,
component
,
exc_info
=
True
)
fragment
=
Fragment
(
render_to_string
(
'html_error.html'
,
{
'message'
:
str
(
exc
)}))
store
.
save_xmodule
(
component
)
# change not authored by requestor but by xblocks. should not convert to draft if not
# already draft
if
getattr
(
component
,
'is_draft'
,
False
):
modulestore
(
'draft'
)
.
update_item
(
component
,
None
)
else
:
modulestore
(
'direct'
)
.
update_item
(
component
,
None
)
elif
view_name
==
'student_view'
and
component
.
has_children
:
# For non-leaf xblocks on the unit page, show the special rendering
# which links to the new container page.
...
...
cms/envs/bok_choy.py
View file @
ca0dd839
...
...
@@ -16,7 +16,7 @@ os.environ['SERVICE_VARIANT'] = 'bok_choy'
os
.
environ
[
'CONFIG_ROOT'
]
=
path
(
__file__
)
.
abspath
()
.
dirname
()
#pylint: disable=E1120
from
.aws
import
*
# pylint: disable=W0401, W0614
from
xmodule.
x_modul
e
import
prefer_xmodules
from
xmodule.
modulestor
e
import
prefer_xmodules
######################### Testing overrides ####################################
...
...
common/lib/xmodule/xmodule/modulestore/__init__.py
View file @
ca0dd839
...
...
@@ -479,7 +479,9 @@ class ModuleStoreReadBase(ModuleStoreRead):
metadata_inheritance_cache_subsystem
=
None
,
request_cache
=
None
,
modulestore_update_signal
=
None
,
xblock_mixins
=
(),
xblock_select
=
None
,
# temporary parms to enable backward compatibility. remove once all envs migrated
db
=
None
,
collection
=
None
,
host
=
None
,
port
=
None
,
tz_aware
=
True
,
user
=
None
,
password
=
None
db
=
None
,
collection
=
None
,
host
=
None
,
port
=
None
,
tz_aware
=
True
,
user
=
None
,
password
=
None
,
# allow lower level init args to pass harmlessly
**
kwargs
):
'''
Set up the error-tracking logic.
...
...
common/lib/xmodule/xmodule/modulestore/locator.py
View file @
ca0dd839
...
...
@@ -51,6 +51,12 @@ class Locator(object):
def
__eq__
(
self
,
other
):
return
self
.
__dict__
==
other
.
__dict__
def
__hash__
(
self
):
"""
Hash on contents.
"""
return
hash
(
unicode
(
self
))
def
__repr__
(
self
):
'''
repr(self) returns something like this: CourseLocator("mit.eecs.6002x")
...
...
@@ -198,16 +204,16 @@ class CourseLocator(Locator):
"""
Return a string representing this location.
"""
result
=
u""
if
self
.
package_id
:
result
=
unicode
(
self
.
package_id
)
result
+
=
unicode
(
self
.
package_id
)
if
self
.
branch
:
result
+=
'/'
+
BRANCH_PREFIX
+
self
.
branch
return
result
elif
self
.
version_guid
:
return
u"{prefix}{guid}"
.
format
(
prefix
=
VERSION_PREFIX
,
guid
=
self
.
version_guid
)
else
:
# raise InsufficientSpecificationError("missing package_id or version_guid")
return
'<InsufficientSpecificationError: missing package_id or version_guid>'
if
self
.
version_guid
:
if
self
.
package_id
:
result
+=
u"/"
result
+=
u"{prefix}{guid}"
.
format
(
prefix
=
VERSION_PREFIX
,
guid
=
self
.
version_guid
)
return
result
def
url
(
self
):
"""
...
...
@@ -432,22 +438,29 @@ class BlockUsageLocator(CourseLocator):
def
version_agnostic
(
self
):
"""
Returns a copy of itself.
If both version_guid and package_id are known, use a blank package_id in the copy.
We don't care if the locator's version is not the current head; so, avoid version conflict
by reducing info.
Returns a copy of itself without any version info.
:raises: ValueError if the block locator has no package_id
:param block_locator:
"""
if
self
.
version_guid
:
return
BlockUsageLocator
(
version_guid
=
self
.
version_guid
,
branch
=
self
.
branch
,
block_id
=
self
.
block_id
)
else
:
return
BlockUsageLocator
(
package_id
=
self
.
package_id
,
branch
=
self
.
branch
,
block_id
=
self
.
block_id
)
return
BlockUsageLocator
(
package_id
=
self
.
package_id
,
branch
=
self
.
branch
,
block_id
=
self
.
block_id
)
def
course_agnostic
(
self
):
"""
We only care about the locator's version not its course.
Returns a copy of itself without any course info.
:raises: ValueError if the block locator has no version_guid
:param block_locator:
"""
return
BlockUsageLocator
(
version_guid
=
self
.
version_guid
,
block_id
=
self
.
block_id
)
def
set_block_id
(
self
,
new
):
"""
...
...
common/lib/xmodule/xmodule/modulestore/mixed.py
View file @
ca0dd839
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
ca0dd839
...
...
@@ -633,8 +633,7 @@ class MongoModuleStore(ModuleStoreWriteBase):
raise
ValueError
(
u"Course roots must be of category 'course': {}"
.
format
(
unicode
(
location
)))
return
self
.
create_and_save_xmodule
(
location
,
definition_data
,
metadata
,
runtime
)
def
create_xmodule
(
self
,
location
,
definition_data
=
None
,
metadata
=
None
,
system
=
None
,
fields
=
{}):
def
create_xmodule
(
self
,
location
,
definition_data
=
None
,
metadata
=
None
,
system
=
None
,
fields
=
{}):
"""
Create the new xmodule but don't save it. Returns the new module.
...
...
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
View file @
ca0dd839
...
...
@@ -92,7 +92,7 @@ class DraftModuleStore(MongoModuleStore):
except
ItemNotFoundError
:
return
wrap_draft
(
super
(
DraftModuleStore
,
self
)
.
get_instance
(
course_id
,
location
,
depth
=
depth
))
def
create_xmodule
(
self
,
location
,
definition_data
=
None
,
metadata
=
None
,
system
=
None
):
def
create_xmodule
(
self
,
location
,
definition_data
=
None
,
metadata
=
None
,
system
=
None
,
fields
=
{}
):
"""
Create the new xmodule but don't save it. Returns the new module with a draft locator
...
...
@@ -104,7 +104,7 @@ class DraftModuleStore(MongoModuleStore):
draft_loc
=
as_draft
(
location
)
if
draft_loc
.
category
in
DIRECT_ONLY_CATEGORIES
:
raise
InvalidVersionError
(
location
)
return
super
(
DraftModuleStore
,
self
)
.
create_xmodule
(
draft_loc
,
definition_data
,
metadata
,
system
)
return
super
(
DraftModuleStore
,
self
)
.
create_xmodule
(
draft_loc
,
definition_data
,
metadata
,
system
,
fields
)
def
get_items
(
self
,
location
,
course_id
=
None
,
depth
=
0
,
qualifiers
=
None
):
"""
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
ca0dd839
...
...
@@ -556,8 +556,8 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
The block's history tracks its explicit changes but not the changes in its children.
'''
#
version
_agnostic means we don't care if the head and version don't align, trust the version
course_struct
=
self
.
_lookup_course
(
block_locator
.
version
_agnostic
())[
'structure'
]
#
course
_agnostic means we don't care if the head and version don't align, trust the version
course_struct
=
self
.
_lookup_course
(
block_locator
.
course
_agnostic
())[
'structure'
]
block_id
=
block_locator
.
block_id
update_version_field
=
'blocks.{}.edit_info.update_version'
.
format
(
block_id
)
all_versions_with_block
=
self
.
db_connection
.
find_matching_structures
({
'original_version'
:
course_struct
[
'original_version'
],
...
...
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
View file @
ca0dd839
...
...
@@ -33,7 +33,6 @@ def mixed_store_config(data_dir, mappings):
'ENGINE'
:
'xmodule.modulestore.mixed.MixedModuleStore'
,
'OPTIONS'
:
{
'mappings'
:
mappings
,
'reference_type'
:
'xmodule.modulestore.Location'
,
'stores'
:
{
'default'
:
mongo_config
[
'default'
],
'xml'
:
xml_config
[
'default'
]
...
...
@@ -219,14 +218,17 @@ class ModuleStoreTestCase(TestCase):
# even if we're using a mixed modulestore
store
=
editable_modulestore
()
if
hasattr
(
store
,
'collection'
):
connection
=
store
.
collection
.
database
.
connection
store
.
collection
.
drop
()
store
.
db
.
connection
.
close
()
connection
.
close
()
elif
hasattr
(
store
,
'close_all_connections'
):
store
.
close_all_connections
()
if
contentstore
()
.
fs_files
:
db
=
contentstore
()
.
fs_files
.
database
db
.
connection
.
drop_database
(
db
)
db
.
connection
.
close
()
location_mapper
=
loc_mapper
()
if
location_mapper
.
db
:
location_mapper
.
location_map
.
drop
()
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_locators.py
View file @
ca0dd839
...
...
@@ -200,13 +200,14 @@ class LocatorTest(TestCase):
expected_id
=
'mit.eecs.6002x'
expected_branch
=
'published'
expected_block_ref
=
'HW3'
testobj
=
BlockUsageLocator
(
package_id
=
testurn
)
testobj
=
BlockUsageLocator
(
url
=
testurn
)
self
.
check_block_locn_fields
(
testobj
,
'test_block constructor'
,
package_id
=
expected_id
,
branch
=
expected_branch
,
block
=
expected_block_ref
)
self
.
assertEqual
(
str
(
testobj
),
testurn
)
self
.
assertEqual
(
testobj
.
url
(),
'edx://'
+
testurn
)
testobj
=
BlockUsageLocator
(
url
=
testurn
,
version_guid
=
ObjectId
())
agnostic
=
testobj
.
version_agnostic
()
self
.
assertIsNone
(
agnostic
.
version_guid
)
self
.
check_block_locn_fields
(
agnostic
,
'test_block constructor'
,
...
...
@@ -225,7 +226,7 @@ class LocatorTest(TestCase):
block
=
'lab2'
,
version_guid
=
ObjectId
(
test_id_loc
)
)
agnostic
=
testobj
.
version
_agnostic
()
agnostic
=
testobj
.
course
_agnostic
()
self
.
check_block_locn_fields
(
agnostic
,
'error parsing URL with version and block'
,
block
=
'lab2'
,
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
ca0dd839
This diff is collapsed.
Click to expand it.
lms/envs/acceptance.py
View file @
ca0dd839
...
...
@@ -45,7 +45,6 @@ MODULESTORE = {
'ENGINE'
:
'xmodule.modulestore.mixed.MixedModuleStore'
,
'OPTIONS'
:
{
'mappings'
:
{},
'reference_type'
:
'xmodule.modulestore.Location'
,
'stores'
:
{
'default'
:
{
'ENGINE'
:
'xmodule.modulestore.mongo.MongoModuleStore'
,
...
...
lms/envs/cms/dev.py
View file @
ca0dd839
...
...
@@ -32,7 +32,6 @@ MODULESTORE = {
'default'
:
{
'ENGINE'
:
'xmodule.modulestore.mixed.MixedModuleStore'
,
'OPTIONS'
:
{
'reference_type'
:
'Location'
,
'mappings'
:
{},
'stores'
:
{
'default'
:
{
...
...
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