Instead of calculating the course's usage key, just follow the parent chain.

This commit is contained in:
David Ormsbee
2015-07-13 17:54:01 -04:00
committed by Calen Pennington
parent abcdc05af4
commit 693901529c

View File

@@ -66,11 +66,13 @@ class DiscussionModule(DiscussionFields, XModule):
def get_course(self):
"""
Return the CourseDescriptor by course id.
Return the CourseDescriptor at the root of the tree we're in.
"""
course_key = self.location.course_key
root_course_loc = course_key.make_usage_key(u'course', u'course')
return self.runtime.get_block(root_course_loc)
block = self
while block.parent:
block = block.get_parent()
return block
class DiscussionDescriptor(DiscussionFields, MetadataOnlyEditingDescriptor, RawDescriptor):