diff --git a/common/lib/xmodule/xmodule/modulestore/locations.py b/common/lib/xmodule/xmodule/modulestore/locations.py index bdd13c932c..ae552cde37 100644 --- a/common/lib/xmodule/xmodule/modulestore/locations.py +++ b/common/lib/xmodule/xmodule/modulestore/locations.py @@ -36,6 +36,14 @@ class SlashSeparatedCourseKey(CourseKey): KEY_FIELDS = ('org', 'course', 'run') __slots__ = KEY_FIELDS + def __init__(self, org, course, run): + """ + checks that the values are syntactically valid before creating object + """ + for part in (org, course, run): + LocationBase._check_location_part(part, INVALID_CHARS) + super(SlashSeparatedCourseKey, self).__init__(org, course, run) + @classmethod def _from_string(cls, serialized): serialized = serialized.replace("+", "/")