Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ def validate_course_olx(courselike_key, course_dir, status):
ignore=settings.COURSE_OLX_VALIDATION_IGNORE_LIST,
allowed_xblocks=ALL_ALLOWED_XBLOCKS
)
except Exception: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this changed?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added "as e" after Exception to print it. Awais bhai told me LOGGER.Exception prints exception. Restored old code.

LOGGER.exception(f'{log_prefix}: CourseOlx could not be validated')
return olx_is_valid

Expand Down
7 changes: 6 additions & 1 deletion common/lib/xmodule/xmodule/modulestore/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ def try_load_course(self, course_dir, course_ids=None, target_course_id=None):
raise exc
finally:
if course_descriptor is None:
pass
if str(target_course_id) == "course-v1:ArbiX+CS101+2014_T3":
logging.info("Course Descriptor is None")
elif isinstance(course_descriptor, ErrorBlock):
# Didn't load course. Instead, save the errors elsewhere.
self.errored_courses[course_dir] = errorlog
Expand Down Expand Up @@ -487,6 +488,8 @@ def load_course(self, course_dir, course_ids, tracker, target_course_id=None):
course_id = self.get_id(org, course, url_name)

if course_ids is not None and course_id not in course_ids:
if str(target_course_id) == "course-v1:ArbiX+CS101+2014_T3":
logging.info("Course ID not in Course IDs (List)")
return None

def get_policy(usage_id):
Expand Down Expand Up @@ -522,6 +525,8 @@ def get_policy(usage_id):
course_descriptor = system.process_xml(etree.tostring(course_data, encoding='unicode'))
# If we fail to load the course, then skip the rest of the loading steps
if isinstance(course_descriptor, ErrorBlock):
if str(target_course_id) == "course-v1:ArbiX+CS101+2014_T3":
logging.info("Course Descriptor is instance of ErrorBlock")
return course_descriptor

self.content_importers(system, course_descriptor, course_dir, url_name)
Expand Down
11 changes: 11 additions & 0 deletions common/lib/xmodule/xmodule/modulestore/xml_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ def run_imports(self):
"""
Iterate over the given directories and yield courses.
"""
if str(self.target_id) == "course-v1:ArbiX+CS101+2014_T3":
logging.info("Starting run imports")
self.preflight()
for courselike_key in self.xml_module_store.modules.keys():
try:
Expand All @@ -558,12 +560,18 @@ def run_imports(self):

# Import all static pieces.
self.import_static(data_path, dest_id)
if str(self.target_id) == "course-v1:ArbiX+CS101+2014_T3":
logging.info("Import Static Successful")

# Import asset metadata stored in XML.
self.import_asset_metadata(data_path, dest_id)
if str(self.target_id) == "course-v1:ArbiX+CS101+2014_T3":
logging.info("Import Asset Metadata Successful")

# Import all children
self.import_children(source_courselike, courselike, courselike_key, dest_id)
if str(self.target_id) == "course-v1:ArbiX+CS101+2014_T3":
logging.info("Import Children Successful")

# This bulk operation wraps all the operations to populate the draft branch with any items
# from the /drafts subdirectory.
Expand All @@ -573,6 +581,9 @@ def run_imports(self):
with self.store.bulk_operations(dest_id):
# Import all draft items into the courselike.
courselike = self.import_drafts(courselike, courselike_key, data_path, dest_id)
if str(self.target_id) == "course-v1:ArbiX+CS101+2014_T3":
logging.info("Import Draft Successful")


yield courselike

Expand Down