From 2632fd7ecd7b5d8d87bf6ce1de880d7b6d7fbd92 Mon Sep 17 00:00:00 2001 From: Akiva Leffert Date: Mon, 10 Aug 2015 17:26:36 -0400 Subject: [PATCH] Show vaguer error message if using default start date --- lms/djangoapps/courseware/access_response.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lms/djangoapps/courseware/access_response.py b/lms/djangoapps/courseware/access_response.py index 00c120d833..4aad91c80b 100644 --- a/lms/djangoapps/courseware/access_response.py +++ b/lms/djangoapps/courseware/access_response.py @@ -3,6 +3,7 @@ This file contains all the classes used by has_access for error handling """ from django.utils.translation import ugettext as _ +from xmodule.course_metadata_utils import DEFAULT_START_DATE class AccessResponse(object): @@ -85,10 +86,13 @@ class StartDateError(AccessError): """ def __init__(self, start_date): error_code = "course_not_started" - developer_message = "Course does not start until {}".format(start_date) - user_message = _("Course does not start until {}" # pylint: disable=translation-of-non-string - .format("{:%B %d, %Y}".format(start_date))) - + if start_date == DEFAULT_START_DATE: + developer_message = "Course has not started" + user_message = _("Course has not started") + else: + developer_message = "Course does not start until {}".format(start_date) + user_message = _("Course does not start until {}" # pylint: disable=translation-of-non-string + .format("{:%B %d, %Y}".format(start_date))) super(StartDateError, self).__init__(error_code, developer_message, user_message)