From 03c9b012130590d71abafa2fb746ed5dd602f339 Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Tue, 6 May 2014 11:17:38 -0400 Subject: [PATCH] fixup! Make course ids and usage ids opaque to LMS and Studio [partial commit] --- common/lib/xmodule/xmodule/modulestore/locations.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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("+", "/")