def __init__(self, modulestore, course_entry, default_class, module_data, lazy, **kwargs): """ Computes the settings inheritance and sets up the cache. modulestore: the module store that can be used to retrieve additional modules course_entry: the originally fetched enveloped course_structure w/ branch and course id info. Callers to _load_item provide an override but that function ignores the provided structure and only looks at the branch and course id module_data: a dict mapping Location -> json that was cached from the underlying modulestore """ super(CachingDescriptorSystem, self).__init__(field_data=None, load_item=self._load_item, **kwargs) self.modulestore = modulestore self.course_entry = course_entry self.lazy = lazy self.module_data = module_data # Compute inheritance modulestore.inherit_settings( course_entry['structure'].get('blocks', {}), course_entry['structure'].get('blocks', {}).get( encode_key_for_mongo(course_entry['structure'].get('root')))) self.default_class = default_class self.local_modules = {}
def __init__(self, modulestore, course_entry, default_class, module_data, lazy, **kwargs): """ Computes the settings inheritance and sets up the cache. modulestore: the module store that can be used to retrieve additional modules course_entry: the originally fetched enveloped course_structure w/ branch and course id info. Callers to _load_item provide an override but that function ignores the provided structure and only looks at the branch and course id module_data: a dict mapping Location -> json that was cached from the underlying modulestore """ super(CachingDescriptorSystem, self).__init__( field_data=None, load_item=self._load_item, **kwargs ) self.modulestore = modulestore self.course_entry = course_entry self.lazy = lazy self.module_data = module_data # Compute inheritance modulestore.inherit_settings( course_entry['structure'].get('blocks', {}), course_entry['structure'].get('blocks', {}).get( encode_key_for_mongo(course_entry['structure'].get('root')) ) ) self.default_class = default_class self.local_modules = {}
def __init__(self, modulestore, course_entry, default_class, module_data, lazy, **kwargs): """ Computes the settings inheritance and sets up the cache. modulestore: the module store that can be used to retrieve additional modules course_entry: the originally fetched enveloped course_structure w/ branch and course id info plus a dictionary of cached inherited_settings indexed by (block_type, block_id) tuple. Callers to _load_item provide an override but that function ignores the provided structure and only looks at the branch and course id module_data: a dict mapping Location -> json that was cached from the underlying modulestore """ # needed by capa_problem (as runtime.filestore via this.resources_fs) if 'course' in course_entry: root = modulestore.fs_root / course_entry['org'] / course_entry[ 'course'] / course_entry['run'] else: root = modulestore.fs_root / course_entry['structure']['_id'] root.makedirs_p() # create directory if it doesn't exist super(CachingDescriptorSystem, self).__init__(field_data=None, load_item=self._load_item, resources_fs=OSFS(root), **kwargs) self.modulestore = modulestore self.course_entry = course_entry self.lazy = lazy self.module_data = module_data # Compute inheritance modulestore.inherit_settings( course_entry['structure'].get('blocks', {}), encode_key_for_mongo(course_entry['structure'].get('root')), course_entry.setdefault('inherited_settings', {}), ) self.default_class = default_class self.local_modules = {}
def __init__(self, modulestore, course_entry, default_class, module_data, lazy, **kwargs): """ Computes the settings inheritance and sets up the cache. modulestore: the module store that can be used to retrieve additional modules course_entry: the originally fetched enveloped course_structure w/ branch and course id info. Callers to _load_item provide an override but that function ignores the provided structure and only looks at the branch and course id module_data: a dict mapping Location -> json that was cached from the underlying modulestore """ # needed by capa_problem (as runtime.filestore via this.resources_fs) if 'course' in course_entry: root = modulestore.fs_root / course_entry['org'] / course_entry['course'] / course_entry['run'] else: root = modulestore.fs_root / course_entry['structure']['_id'] root.makedirs_p() # create directory if it doesn't exist super(CachingDescriptorSystem, self).__init__( field_data=None, load_item=self._load_item, resources_fs = OSFS(root), **kwargs ) self.modulestore = modulestore self.course_entry = course_entry self.lazy = lazy self.module_data = module_data # Compute inheritance modulestore.inherit_settings( course_entry['structure'].get('blocks', {}), course_entry['structure'].get('blocks', {}).get( encode_key_for_mongo(course_entry['structure'].get('root')) ) ) self.default_class = default_class self.local_modules = {}