Commit 6f322bcd by Ned Batchelder

Simplify the construction of the ErrorDescriptor

parent 376575de
...@@ -276,15 +276,16 @@ def _get_module(user, request, location, student_module_cache, course_id, positi ...@@ -276,15 +276,16 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
log.exception("Error creating module from descriptor {0}".format(descriptor)) log.exception("Error creating module from descriptor {0}".format(descriptor))
# make an ErrorDescriptor -- assuming that the descriptor's system is ok # make an ErrorDescriptor -- assuming that the descriptor's system is ok
import_system = descriptor.system
if has_access(user, location, 'staff', course_id): if has_access(user, location, 'staff', course_id):
err_descriptor = ErrorDescriptor.from_xml(str(descriptor), import_system, err_descriptor_class = ErrorDescriptor
org=descriptor.location.org, course=descriptor.location.course,
error_msg=exc_info_to_str(sys.exc_info()))
else: else:
err_descriptor = NonStaffErrorDescriptor.from_xml(str(descriptor), import_system, err_descriptor_class = NonStaffErrorDescriptor
org=descriptor.location.org, course=descriptor.location.course,
error_msg=exc_info_to_str(sys.exc_info())) err_descriptor = err_descriptor_class.from_xml(
str(descriptor), descriptor.system,
org=descriptor.location.org, course=descriptor.location.course,
error_msg=exc_info_to_str(sys.exc_info())
)
# Make an error module # Make an error module
return err_descriptor.xmodule(system) return err_descriptor.xmodule(system)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment