/
githubmirror
/
edx-platform
Обзор
Документация
Войти
/
githubmirror
/
edx-platform
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
release-ulmo
lms/djangoapps/courseware/exceptions.py
43 строки
1 KB
Usama Sadiq
refactor: ran pyupgrade on lms/djangoapps/courseware (#26737)
12 мар 2021, 10:15
Не верифицирован
12 мар 2021, 10:15
859df03
Код
Авторство
О чём код?
""" Exception classes used in lms/courseware. """ class Redirect(Exception): """ Exception class that requires redirecting to a URL. """ def __init__(self, url): super().__init__() self.url = url class CourseAccessRedirect(Redirect): """ Redirect raised when user does not have access to a course. Arguments: url (string): The redirect url. access_error (AccessErro): The AccessError that caused the redirect. The AccessError contains messages for developers and users explaining why the user was denied access. These strings can then be exposed to the user. """ def __init__(self, url, access_error=None): super().__init__(url) self.access_error = access_error class CourseRunNotFound(ValueError): """ Indicate that a supplied course run key does not map to a course run in the system. """ def __init__(self, course_key): """ Initialize CourseRunNotFound exception. Arguments: course_key (CourseKey|str): course run key or stringified version thereof. """ super().__init__(f"Course run not found: {course_key}")