diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ba64552973..729c94b105 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,9 @@ the top. Include a label indicating the component affected. Studio: Remove XML from the video component editor. All settings are moved to be edited as metadata. +LMS: Forums. Added handling for case where discussion module can get `None` as +value of lms.start in `lms/djangoapps/django_comment_client/utils.py` + Studio, LMS: Make ModelTypes more strict about their expected content (for instance, Boolean, Integer, String), but also allow them to hold either the typed value, or a String that can be converted to their typed value. For example, diff --git a/cms/envs/aws.py b/cms/envs/aws.py index a6d6e2f847..c6a383211f 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -112,12 +112,6 @@ TIME_ZONE = ENV_TOKENS.get('TIME_ZONE', TIME_ZONE) for feature, value in ENV_TOKENS.get('MITX_FEATURES', {}).items(): MITX_FEATURES[feature] = value -# If Segment.io key specified, load it and turn on Segment.io if the feature flag is set -# Note that this is the Studio key. There is a separate key for the LMS. -SEGMENT_IO_KEY = AUTH_TOKENS.get('SEGMENT_IO_KEY') -if SEGMENT_IO_KEY: - MITX_FEATURES['SEGMENT_IO'] = ENV_TOKENS.get('SEGMENT_IO', False) - LOGGING = get_logger_config(LOG_DIR, logging_env=ENV_TOKENS['LOGGING_ENV'], syslog_addr=(ENV_TOKENS['SYSLOG_SERVER'], 514), @@ -129,6 +123,13 @@ LOGGING = get_logger_config(LOG_DIR, with open(ENV_ROOT / CONFIG_PREFIX + "auth.json") as auth_file: AUTH_TOKENS = json.load(auth_file) +# If Segment.io key specified, load it and turn on Segment.io if the feature flag is set +# Note that this is the Studio key. There is a separate key for the LMS. +SEGMENT_IO_KEY = AUTH_TOKENS.get('SEGMENT_IO_KEY') +if SEGMENT_IO_KEY: + MITX_FEATURES['SEGMENT_IO'] = ENV_TOKENS.get('SEGMENT_IO', False) + + AWS_ACCESS_KEY_ID = AUTH_TOKENS["AWS_ACCESS_KEY_ID"] AWS_SECRET_ACCESS_KEY = AUTH_TOKENS["AWS_SECRET_ACCESS_KEY"] DATABASES = AUTH_TOKENS['DATABASES'] diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py index 6e9f6c1f71..496c834950 100644 --- a/lms/djangoapps/django_comment_client/utils.py +++ b/lms/djangoapps/django_comment_client/utils.py @@ -1,9 +1,9 @@ +import pytz from collections import defaultdict import logging import urllib from datetime import datetime -from courseware.module_render import get_module from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.db import connection @@ -169,7 +169,9 @@ def initialize_discussion_info(course): category = " / ".join([x.strip() for x in category.split("/")]) last_category = category.split("/")[-1] discussion_id_map[id] = {"location": module.location, "title": last_category + " / " + title} - unexpanded_category_map[category].append({"title": title, "id": id, "sort_key": sort_key, "start_date": module.lms.start}) + #Handle case where module.lms.start is None + entry_start_date = module.lms.start if module.lms.start else datetime.max.replace(tzinfo=pytz.UTC) + unexpanded_category_map[category].append({"title": title, "id": id, "sort_key": sort_key, "start_date": entry_start_date}) category_map = {"entries": defaultdict(dict), "subcategories": defaultdict(dict)} for category_path, entries in unexpanded_category_map.items():