1
1
"""
2
2
Implements an API for updating unit and course settings.
3
3
"""
4
- from ai_aside .config_api .internal import NotFoundError , _get_course , _get_course_units , _get_unit
4
+ from ai_aside .config_api .exceptions import AiAsideNotFoundException
5
+ from ai_aside .config_api .internal import _get_course , _get_course_units , _get_unit
5
6
from ai_aside .models import AIAsideCourseEnabled , AIAsideUnitEnabled
6
7
from ai_aside .waffle import summaries_configuration_enabled
7
8
@@ -28,7 +29,7 @@ def set_course_settings(course_key, settings):
28
29
Expects: settings to be a dictionary of the form:
29
30
`{'enabled': bool}`
30
31
31
- Raises NotFoundError if the settings are not found.
32
+ Raises AiAsideNotFoundException if the settings are not found.
32
33
"""
33
34
enabled = settings ['enabled' ]
34
35
@@ -47,7 +48,7 @@ def delete_course_settings(course_key):
47
48
"""
48
49
Deletes the settings of a course.
49
50
50
- Raises NotFoundError if the settings are not found.
51
+ Raises AiAsideNotFoundException if the settings are not found.
51
52
"""
52
53
reset_course_unit_settings (course_key )
53
54
record = _get_course (course_key )
@@ -84,7 +85,7 @@ def set_unit_settings(course_key, unit_key, settings):
84
85
Expects: settings as a dictionary of the form:
85
86
`{'enabled': bool}`
86
87
87
- Raises NotFoundError if the settings are not found.
88
+ Raises AiAsideNotFoundException if the settings are not found.
88
89
"""
89
90
enabled = settings ['enabled' ]
90
91
@@ -104,7 +105,7 @@ def delete_unit_settings(course_key, unit_key):
104
105
"""
105
106
Deletes the settings of a unit.
106
107
107
- Raises NotFoundError if the settings are not found.
108
+ Raises AiAsideNotFoundException if the settings are not found.
108
109
"""
109
110
record = _get_unit (course_key , unit_key )
110
111
record .delete ()
@@ -127,7 +128,7 @@ def is_course_settings_present(course_key):
127
128
try :
128
129
course = _get_course (course_key )
129
130
return course is not None
130
- except NotFoundError :
131
+ except AiAsideNotFoundException :
131
132
return False
132
133
133
134
@@ -147,12 +148,12 @@ def is_summary_enabled(course_key, unit_key=None):
147
148
148
149
if unit is not None :
149
150
return unit .enabled
150
- except NotFoundError :
151
+ except AiAsideNotFoundException :
151
152
pass
152
153
153
154
try :
154
155
course = _get_course (course_key )
155
- except NotFoundError :
156
+ except AiAsideNotFoundException :
156
157
return False
157
158
158
159
if course is not None :
0 commit comments