Esempio n. 1
0
def run():
    """
    Executed during django startup
    """

    # Patch the xml libs.
    from safe_lxml import defuse_xml_libs
    defuse_xml_libs()

    django_utils_translation.patch()

    autostartup()

    add_mimetypes()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()

    if settings.FEATURES.get('USE_MICROSITES', False):
        enable_microsites()

    if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH', False):
        enable_third_party_auth()

    # Initialize Segment.io analytics module. Flushes first time a message is received and 
    # every 50 messages thereafter, or if 10 seconds have passed since last flush
    if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'):
        analytics.init(settings.SEGMENT_IO_LMS_KEY, flush_at=50)
Esempio n. 2
0
def run():
    """
    Executed during django startup
    """
    django_utils_translation.patch()

    autostartup()

    add_mimetypes()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()

    if settings.FEATURES.get('USE_MICROSITES', False):
        enable_microsites()

    if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH', False):
        enable_third_party_auth()

    # Initialize Segment.io analytics module. Flushes first time a message is received and
    # every 50 messages thereafter, or if 10 seconds have passed since last flush
    if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'):
        analytics.init(settings.SEGMENT_IO_LMS_KEY, flush_at=50)

    # Monkey patch the keyword function map
    if keyword_substitution.keyword_function_map_is_empty():
        keyword_substitution.add_keyword_function_map(get_keyword_function_map())
        # Once keyword function map is set, make update function do nothing
        keyword_substitution.add_keyword_function_map = lambda x: None
Esempio n. 3
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    add_mimetypes()
Esempio n. 4
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()
Esempio n. 5
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()
Esempio n. 6
0
def run():
    """
    Executed during django startup
    """
    django_utils_translation.patch()

    autostartup()

    add_mimetypes()
Esempio n. 7
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    # trigger a forced initialization of our modulestores since this can take a while to complete
    # and we want this done before HTTP requests are accepted
    for store_name in settings.MODULESTORE:
    	modulestore(store_name)
Esempio n. 8
0
def run():
    """
    Executed during django startup
    """
    global INITIALIZED
    if INITIALIZED:
        return

    INITIALIZED = True
    autostartup()
Esempio n. 9
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    # Trigger a forced initialization of our modulestores since this can take a while to complete
    # and we want this done before HTTP requests are accepted.
    if settings.INIT_MODULESTORE_ON_STARTUP:
        for store_name in settings.MODULESTORE:
            modulestore(store_name)
Esempio n. 10
0
def run():
    """
    Executed during django startup
    """
    django_utils_translation.patch()

    autostartup()

    add_mimetypes()

    if settings.FEATURES.get("USE_CUSTOM_THEME", False):
        enable_theme()
Esempio n. 11
0
def run():
    """
    Executed during django startup
    """
    django_utils_translation.patch()

    autostartup()

    add_mimetypes()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()
Esempio n. 12
0
def run():
    """
    Executed during django startup
    """
    # Patch the xml libs.
    from safe_lxml import defuse_xml_libs
    defuse_xml_libs()

    django_utils_translation.patch()

    autostartup()

    add_mimetypes()
Esempio n. 13
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    # Trigger a forced initialization of our modulestores since this can take a
    # while to complete and we want this done before HTTP requests are accepted.
    if settings.INIT_MODULESTORE_ON_STARTUP:
        for store_name in settings.MODULESTORE:
            modulestore(store_name)

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()
Esempio n. 14
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()

    if settings.FEATURES.get('USE_MICROSITES', False):
        enable_microsites()

    if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH', False):
        enable_third_party_auth()
Esempio n. 15
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    # Trigger a forced initialization of our modulestores since this can take a
    # while to complete and we want this done before HTTP requests are accepted.
    if settings.INIT_MODULESTORE_ON_STARTUP:
        for store_name in settings.MODULESTORE:
            modulestore(store_name)

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()
Esempio n. 16
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()

    if settings.FEATURES.get('USE_MICROSITES', False):
        enable_microsites()

    if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH', False):
        enable_third_party_auth()
Esempio n. 17
0
def run():
    """
    Executed during django startup
    """
    global INITIALIZED
    if INITIALIZED:
        return

    INITIALIZED = True
    autostartup()

    # Do the patching here
    from ifmo_mod.patch import patch
    patch()
Esempio n. 18
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    # Trigger a forced initialization of our modulestores since this can take a while to complete
    # and we want this done before HTTP requests are accepted.
    if settings.INIT_MODULESTORE_ON_STARTUP:
        for store_name in settings.MODULESTORE:
            modulestore(store_name)

    # Do the patching here
    from ifmo_mod.patch import patch
    patch()
Esempio n. 19
0
def run():
    """
    Executed during django startup
    """
    django_utils_translation.patch()

    autostartup()

    add_mimetypes()

	if settings.FEATURES.get('USE_CUSTOM_THEME'):
        theme_root = settings.ENV_ROOT / 'themes' / settings.THEME_NAME
        settings.STATICFILES_DIRS.append(
            (u'themes/{}'.format(settings.THEME_NAME), theme_root / 'static')
        )
Esempio n. 20
0
def run():
    """
    Executed during django startup
    """
    # Patch the xml libs.
    from safe_lxml import defuse_xml_libs
    defuse_xml_libs()

    django_utils_translation.patch()

    autostartup()

    add_mimetypes()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()
Esempio n. 21
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    add_mimetypes()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()

    if settings.FEATURES.get('USE_MICROSITES', False):
        enable_microsites()

    if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH', False):
        enable_third_party_auth()

    # Initialize Segment.io analytics module. Flushes first time a message is received and 
    # every 50 messages thereafter, or if 10 seconds have passed since last flush
    if settings.FEATURES.get('SEGMENT_IO_LMS') and settings.SEGMENT_IO_LMS_KEY:
        analytics.init(settings.SEGMENT_IO_LMS_KEY, flush_at=50)
Esempio n. 22
0
def run():
    """
    Executed during django startup
    """
    autostartup()

    add_mimetypes()

    if settings.FEATURES.get('USE_CUSTOM_THEME', False):
        enable_theme()

    if settings.FEATURES.get('USE_MICROSITES', False):
        enable_microsites()

    if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH', False):
        enable_third_party_auth()

    # Initialize Segment.io analytics module. Flushes first time a message is received and
    # every 50 messages thereafter, or if 10 seconds have passed since last flush
    if settings.FEATURES.get('SEGMENT_IO_LMS') and settings.SEGMENT_IO_LMS_KEY:
        analytics.init(settings.SEGMENT_IO_LMS_KEY, flush_at=50)
Esempio n. 23
0
def run():
    """
    Executed during django startup
    """
    autostartup()
from time import strptime, strftime
from datetime import datetime
from zipfile import ZipFile, is_zipfile

from dogapi import dog_http_api
from pytz import UTC

from django.core.management.base import BaseCommand, CommandError
from django.conf import settings

import django_startup

from student.models import TestCenterUser, TestCenterRegistration


django_startup.autostartup()


class Command(BaseCommand):

    args = '<input zip file>'
    help = """
    Import Pearson confirmation files and update TestCenterUser
    and TestCenterRegistration tables with status.
    """

    @staticmethod
    def datadog_error(string, tags):
        dog_http_api.event("Pearson Import", string, alert_type='error', tags=[tags])

    def handle(self, *args, **kwargs):
Esempio n. 25
0
from optparse import make_option
import os
from stat import S_ISDIR

import boto
from dogapi import dog_http_api, dog_stats_api
import paramiko

from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError

import django_startup

django_startup.autostartup()


class Command(BaseCommand):
    help = """
    This command handles the importing and exporting of student records for
    Pearson.  It uses some other Django commands to export and import the
    files and then uploads over SFTP to Pearson and stuffs the entry in an
    S3 bucket for archive purposes.

    Usage: ./manage.py pearson-transfer --mode [import|export|both]
    """

    option_list = BaseCommand.option_list + (make_option(
        '--mode',
        action='store',
        dest='mode',