<commit_before>import logging

from django.views.decorators.cache import cache_control
from edxmako.shortcuts import render_to_response
from django.core.urlresolvers import reverse

from courseware.courses import get_course_with_access

from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError
import json
from student.models import unique_id_for_user

import open_ended_notifications

from xmodule.modulestore.django import modulestore
from xmodule.modulestore import search
from xmodule.modulestore import SlashSeparatedCourseKey
from xmodule.modulestore.exceptions import NoPathToItem

from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.utils.translation import ugettext as _

from open_ended_grading.utils import (
    STAFF_ERROR_MESSAGE, StudentProblemList, generate_problem_url, create_controller_query_service
)

log = logging.getLogger(__name__)


def _reverse_with_slash(url_name, course_key):
    """
    Reverses the URL given the name and the course id, and then adds a trailing slash if
    it does not exist yet.
    @param url_name: The name of the url (eg 'staff_grading').
    @param course_id: The id of the course object (eg course.id).
    @returns: The reversed url with a trailing slash.
    """
    course_id = course_key.to_deprecated_string()
    ajax_url = _reverse_without_slash(url_name, course_id)
    if not ajax_url.endswith('/'):
        ajax_url += '/'
    return ajax_url


def _reverse_without_slash(url_name, course_id):
    ajax_url = reverse(url_name, kwargs={'course_id': course_id})
    return ajax_url


DESCRIPTION_DICT = {
    'Peer Grading': _("View all problems that require peer assessment in this particular course."),
    'Staff Grading': _("View ungraded submissions submitted by students for the open ended problems in the course."),
    'Problems you have submitted': _("View open ended problems that you have previously submitted for grading."),
    'Flagged Submissions': _("View submissions that have been flagged by students as inappropriate."),
}

ALERT_DICT = {
    'Peer Grading': _("New submissions to grade"),<commit_msg>Serialize course_key at last possible code junction<commit_after>import logging

from django.views.decorators.cache import cache_control
from edxmako.shortcuts import render_to_response
from django.core.urlresolvers import reverse

from courseware.courses import get_course_with_access

from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError
import json
from student.models import unique_id_for_user

import open_ended_notifications

from xmodule.modulestore.django import modulestore
from xmodule.modulestore import search
from xmodule.modulestore import SlashSeparatedCourseKey
from xmodule.modulestore.exceptions import NoPathToItem

from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.utils.translation import ugettext as _

from open_ended_grading.utils import (
    STAFF_ERROR_MESSAGE, StudentProblemList, generate_problem_url, create_controller_query_service
)

log = logging.getLogger(__name__)


def _reverse_with_slash(url_name, course_key):
    """
    Reverses the URL given the name and the course id, and then adds a trailing slash if
    it does not exist yet.
    @param url_name: The name of the url (eg 'staff_grading').
    @param course_id: The id of the course object (eg course.id).
    @returns: The reversed url with a trailing slash.
    """
    ajax_url = _reverse_without_slash(url_name, course_key)
    if not ajax_url.endswith('/'):
        ajax_url += '/'
    return ajax_url


def _reverse_without_slash(url_name, course_key):
    course_id = course_key.to_deprecated_string()
    ajax_url = reverse(url_name, kwargs={'course_id': course_id})
    return ajax_url


DESCRIPTION_DICT = {
    'Peer Grading': _("View all problems that require peer assessment in this particular course."),
    'Staff Grading': _("View ungraded submissions submitted by students for the open ended problems in the course."),
    'Problems you have submitted': _("View open ended problems that you have previously submitted for grading."),
    'Flagged Submissions': _("View submissions that have been flagged by students as inappropriate."),
}

ALERT_DICT = {
    'Peer Grading': _("New submissions to grade"),
{'fraction_non_alphanumeric': 0.06700554528650647, 'fraction_numerical': 0.0013863216266173752, 'mean_word_length': 5.123055162659123, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3942632', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1227, 'n_words': 409}