Skip to content

Commit

Permalink
DETACHED_CATEGORIES renamed to DETACHED_XBLOCK_TYPES
Browse files Browse the repository at this point in the history
  • Loading branch information
M. Rehan authored and M. Rehan committed Jan 8, 2016
1 parent 910bc12 commit 0de049a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions common/lib/xmodule/xmodule/modulestore/mongo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from xmodule.modulestore.exceptions import ItemNotFoundError, DuplicateCourseError, ReferentialIntegrityError
from xmodule.modulestore.inheritance import InheritanceMixin, inherit_metadata, InheritanceKeyValueStore
from xmodule.modulestore.xml import CourseLocationManager
from xmodule.modulestore.store_utilities import DETACHED_CATEGORIES
from xmodule.modulestore.store_utilities import DETACHED_XBLOCK_TYPES
from xmodule.services import SettingsService

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -268,7 +268,7 @@ def load_item(self, location, for_parent=None): # pylint: disable=method-hidden
)
if parent_url:
parent = self._convert_reference_to_key(parent_url)
if not parent and category not in DETACHED_CATEGORIES + ['course']:
if not parent and category not in DETACHED_XBLOCK_TYPES + ['course']:
# try looking it up just-in-time (but not if we're working with a detached block).
parent = self.modulestore.get_parent_location(
as_published(location),
Expand Down Expand Up @@ -964,7 +964,7 @@ def _should_apply_cached_metadata(self, item, depth):
of inherited metadata onto the item
"""
category = item['location']['category']
apply_cached_metadata = category not in DETACHED_CATEGORIES and \
apply_cached_metadata = category not in DETACHED_XBLOCK_TYPES and \
not (category == 'course' and depth == 0)
return apply_cached_metadata

Expand Down
4 changes: 2 additions & 2 deletions common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
from .caching_descriptor_system import CachingDescriptorSystem
from xmodule.modulestore.split_mongo.mongo_connection import MongoConnection, DuplicateKeyError
from xmodule.modulestore.split_mongo import BlockKey, CourseEnvelope
from xmodule.modulestore.store_utilities import DETACHED_CATEGORIES
from xmodule.modulestore.store_utilities import DETACHED_XBLOCK_TYPES
from xmodule.error_module import ErrorDescriptor
from collections import defaultdict
from types import NoneType
Expand Down Expand Up @@ -1204,7 +1204,7 @@ def _block_matches_all(block_data):
for block_id, value in course.structure['blocks'].iteritems():
if _block_matches_all(value):
if not include_orphans:
if block_id.type in DETACHED_CATEGORIES or self.has_path_to_root(block_id, course):
if block_id.type in DETACHED_XBLOCK_TYPES or self.has_path_to_root(block_id, course):
items.append(block_id)
else:
items.append(block_id)
Expand Down
2 changes: 1 addition & 1 deletion common/lib/xmodule/xmodule/modulestore/store_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import uuid
from xblock.core import XBlock

DETACHED_CATEGORIES = [name for name, __ in XBlock.load_tagged_classes("detached")]
DETACHED_XBLOCK_TYPES = [name for name, __ in XBlock.load_tagged_classes("detached")]


def _prefix_only_url_replace_regex(pattern):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from xmodule.modulestore.exceptions import ItemNotFoundError, DuplicateCourseError, ReferentialIntegrityError, NoPathToItem
from xmodule.modulestore.mixed import MixedModuleStore
from xmodule.modulestore.search import path_to_location, navigation_index
from xmodule.modulestore.store_utilities import DETACHED_CATEGORIES
from xmodule.modulestore.store_utilities import DETACHED_XBLOCK_TYPES
from xmodule.modulestore.tests.factories import check_mongo_calls, check_exact_number_of_calls, \
mongo_uses_error_check
from xmodule.modulestore.tests.utils import create_modulestore_instance, LocationMixin, mock_tab_from_json
Expand Down Expand Up @@ -468,7 +468,7 @@ def test_get_items_include_orphans(self, default_ms, expected_items_in_tree, orp
# Assert that about is a detached category found in get_items
self.assertIn(
[item.location.block_type for item in items if item.location.block_type == 'about'][0],
DETACHED_CATEGORIES
DETACHED_XBLOCK_TYPES
)
self.assertEqual(len(items), 2)

Expand Down

0 comments on commit 0de049a

Please sign in to comment.