Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/lib/xmodule/xmodule/modulestore/mongo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ def create_xmodule(self, location, definition_data=None, metadata=None, system=N
)
xblock_class = XModuleDescriptor.load_class(location.category, self.default_class)
if definition_data is None:
if hasattr(xblock_class, 'data') and getattr(xblock_class, 'data').default is not None:
definition_data = getattr(xblock_class, 'data').default
if hasattr(xblock_class, 'data') and xblock_class.data.default is not None:
definition_data = xblock_class.data.default
else:
definition_data = {}
dbmodel = self._create_new_field_data(location.category, location, definition_data, metadata)
Expand Down
2 changes: 1 addition & 1 deletion common/lib/xmodule/xmodule/modulestore/mongo/draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def wrap_draft(item):
draft, and `False` otherwise. Sets the item's location to the
non-draft location in either case
"""
setattr(item, 'is_draft', item.location.revision == DRAFT)
item.is_draft = (item.location.revision == DRAFT)
item.scope_ids = item.scope_ids._replace(usage_id=item.location.replace(revision=None))
return item

Expand Down
2 changes: 1 addition & 1 deletion common/lib/xmodule/xmodule/modulestore/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def fallback_name(orig_name=None):
err_msg
)

setattr(descriptor, 'data_dir', course_dir)
descriptor.data_dir = course_dir

xmlstore.modules[course_id][descriptor.location] = descriptor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_ajax_request(self):
"Make shure that ajax request works correctly"
# Mock is_condition_satisfied
self.xmodule.is_condition_satisfied = lambda: True
setattr(self.xmodule.descriptor, 'get_children', lambda: [])
self.xmodule.descriptor.get_children = lambda: []

response = self.ajax_request('No', {})
html = response['html']
Expand Down
2 changes: 1 addition & 1 deletion common/lib/xmodule/xmodule/x_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def templates(cls):
@classmethod
def get_template_dir(cls):
if getattr(cls, 'template_dir_name', None):
dirname = os.path.join('templates', getattr(cls, 'template_dir_name'))
dirname = os.path.join('templates', cls.template_dir_name)
if not resource_isdir(__name__, dirname):
log.warning("No resource directory {dir} found when loading {cls_name} templates".format(
dir=dirname,
Expand Down
4 changes: 2 additions & 2 deletions lms/djangoapps/instructor/views/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def get_student_from_identifier(unique_student_identifier):

if settings.MITX_FEATURES['ENABLE_MANUAL_GIT_RELOAD']:
if 'GIT pull' in action:
data_dir = getattr(course, 'data_dir')
data_dir = course.data_dir
log.debug('git pull {0}'.format(data_dir))
gdir = settings.DATA_DIR / data_dir
if not os.path.exists(gdir):
Expand All @@ -222,7 +222,7 @@ def get_student_from_identifier(unique_student_identifier):
if 'Reload course' in action:
log.debug('reloading {0} ({1})'.format(course_id, course))
try:
data_dir = getattr(course, 'data_dir')
data_dir = course.data_dir
modulestore().try_load_course(data_dir)
msg += "<br/><p>Course reloaded from {0}</p>".format(data_dir)
track.views.server_track(request, "reload", {"directory": data_dir}, page="idashboard")
Expand Down
4 changes: 2 additions & 2 deletions lms/djangoapps/lms_migration/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def get_commit_id(course):

def set_commit_id(course, commit_id):
#course.metadata['GIT_COMMIT_ID'] = commit_id
setattr(course, 'GIT_COMMIT_ID', commit_id)
# setattr(def_ms.courses[reload_dir], 'GIT_COMMIT_ID', new_commit_id)
course.GIT_COMMIT_ID = commit_id
# def_ms.courses[reload_dir].GIT_COMMIT_ID = new_commit_id


def manage_modulestores(request, reload_dir=None, commit_id=None):
Expand Down