예제 #1
0
def register_module():
    """Registers this module in the registry."""

    permissions = []

    def permissions_callback(unused_application_context):
        return permissions

    def on_module_enabled():
        resource.Registry.register(resources_display.ResourceCourseSettings)
        resource.Registry.register(resources_display.ResourceUnit)
        resource.Registry.register(resources_display.ResourceAssessment)
        resource.Registry.register(resources_display.ResourceLink)
        resource.Registry.register(resources_display.ResourceLesson)
        resource.Registry.register(resources_display.ResourceSAQuestion)
        resource.Registry.register(resources_display.ResourceMCQuestion)
        resource.Registry.register(resources_display.ResourceQuestionGroup)
        resource.Registry.register(utils.ResourceHtmlHook)

        outline.on_module_enabled(custom_module, permissions)
        assets.on_module_enabled()
        admin_preferences_editor.on_module_enabled()
        course_roles.on_module_enabled(custom_module, permissions)
        settings.on_module_enabled(custom_module, permissions)
        unit_lesson_editor.on_module_enabled(custom_module, permissions)

        roles.Roles.register_permissions(custom_module, permissions_callback)

    # provide parser to verify
    verify.parse_content = content.parse_string_in_scope

    # setup routes
    courses_routes = [
        ('/', lessons.CourseHandler),
        ('/activity', lessons.UnitHandler),
        ('/course', lessons.CourseHandler),
        ('/forum', utils.ForumHandler),
        ('/preview', utils.PreviewHandler),
        ('/register', utils.RegisterHandler),
        ('/rest/locale', utils.StudentLocaleRESTHandler),
        ('/review', lessons.ReviewHandler),
        ('/reviewdashboard', lessons.ReviewDashboardHandler),
        ('/student/editstudent', utils.StudentEditStudentHandler),
        ('/student/settracks', utils.StudentSetTracksHandler),
        ('/student/home', utils.StudentProfileHandler),
        ('/student/unenroll', utils.StudentUnenrollHandler),
        ('/unit', lessons.UnitHandler),
        ]
    courses_routes += admin_preferences_editor.get_namespaced_handlers()
    courses_routes += settings.get_namespaced_handlers()
    courses_routes += unit_lesson_editor.get_namespaced_handlers()
    courses_routes += student_labels.get_namespaced_handlers()

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        MODULE_NAME,
        'A set of pages for delivering an online course.',
        [], courses_routes,
        notify_module_enabled=on_module_enabled)
    return custom_module
예제 #2
0
def register_module():
    """Registers this module in the registry."""

    permissions = []

    def permissions_callback(unused_application_context):
        return permissions

    def on_module_enabled():
        resource.Registry.register(resources_display.ResourceCourseSettings)
        resource.Registry.register(resources_display.ResourceUnit)
        resource.Registry.register(resources_display.ResourceAssessment)
        resource.Registry.register(resources_display.ResourceLink)
        resource.Registry.register(resources_display.ResourceLesson)
        resource.Registry.register(resources_display.ResourceSAQuestion)
        resource.Registry.register(resources_display.ResourceMCQuestion)
        resource.Registry.register(resources_display.ResourceQuestionGroup)
        resource.Registry.register(utils.ResourceHtmlHook)

        outline.on_module_enabled(custom_module)
        assets.on_module_enabled()
        admin_preferences_editor.on_module_enabled()
        availability.on_module_enabled(custom_module, permissions)
        course_roles.on_module_enabled(custom_module, permissions)
        lessons.on_module_enabled(custom_module)
        settings.on_module_enabled(custom_module, permissions)
        unit_lesson_editor.on_module_enabled(custom_module, permissions)

        roles.Roles.register_permissions(custom_module, permissions_callback)

    # provide parser to verify
    verify.parse_content = content.parse_string_in_scope

    # setup routes
    courses_routes = [
        ('/forum', utils.ForumHandler),
        ('/register', utils.RegisterHandler),
        ('/rest/locale', utils.StudentLocaleRESTHandler),
        ('/student/editstudent', utils.StudentEditStudentHandler),
        ('/student/settracks', utils.StudentSetTracksHandler),
        ('/student/home', utils.StudentProfileHandler),
        ('/student/unenroll', utils.StudentUnenrollHandler),
    ]
    courses_routes += admin_preferences_editor.get_namespaced_handlers()
    courses_routes += availability.get_namespaced_handlers()
    courses_routes += settings.get_namespaced_handlers()
    courses_routes += unit_lesson_editor.get_namespaced_handlers()
    courses_routes += student_labels.get_namespaced_handlers()
    courses_routes += lessons.get_namespaced_handlers()

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        MODULE_NAME,
        'A set of pages for delivering an online course.', [],
        courses_routes,
        notify_module_enabled=on_module_enabled)
    return custom_module
예제 #3
0
def register_module():
    """Registers this module in the registry."""
    def on_module_enabled():
        resource.Registry.register(resources_display.ResourceCourseSettings)
        resource.Registry.register(resources_display.ResourceUnit)
        resource.Registry.register(resources_display.ResourceAssessment)
        resource.Registry.register(resources_display.ResourceLink)
        resource.Registry.register(resources_display.ResourceLesson)
        resource.Registry.register(resources_display.ResourceSAQuestion)
        resource.Registry.register(resources_display.ResourceMCQuestion)
        resource.Registry.register(resources_display.ResourceQuestionGroup)
        resource.Registry.register(utils.ResourceHtmlHook)

        outline.on_module_enabled()
        assets.on_module_enabled()
        admin_preferences_editor.on_module_enabled()
        settings.on_module_enabled()

    # provide parser to verify
    verify.parse_content = content.parse_string_in_scope

    # setup routes
    courses_routes = [
        ('/', lessons.CourseHandler),
        ('/activity', lessons.UnitHandler),
        ('/answer', assessments.AnswerHandler),
        ('/assessment', lessons.AssessmentHandler),
        ('/course', lessons.CourseHandler),
        ('/forum', utils.ForumHandler),
        ('/preview', utils.PreviewHandler),
        ('/register', utils.RegisterHandler),
        ('/rest/locale', utils.StudentLocaleRESTHandler),
        ('/review', lessons.ReviewHandler),
        ('/reviewdashboard', lessons.ReviewDashboardHandler),
        ('/student/editstudent', utils.StudentEditStudentHandler),
        ('/student/settracks', utils.StudentSetTracksHandler),
        ('/student/home', utils.StudentProfileHandler),
        ('/student/unenroll', utils.StudentUnenrollHandler),
        ('/unit', lessons.UnitHandler),
        (settings.CourseSettingsRESTHandler.URI,
         settings.CourseSettingsRESTHandler),
        (settings.HtmlHookRESTHandler.URI, settings.HtmlHookRESTHandler),
        (admin_preferences_editor.AdminPreferencesRESTHandler.URI,
         admin_preferences_editor.AdminPreferencesRESTHandler),
    ]
    courses_routes += student_labels.get_namespaced_handlers()

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Course',
        'A set of pages for delivering an online course.', [],
        courses_routes,
        notify_module_enabled=on_module_enabled)
    return custom_module
예제 #4
0
from models import custom_modules
from models import data_sources
from models import student_labels

from handlers import main_handler, course_handlers, cron_handler

# Import, register, & enable modules named in app.yaml's GCB_REGISTERED_MODULES.
appengine_config.import_and_enable_modules()

# Core "module" is always present and registered.
custom_modules.Module(
    'Core REST services', 'A module to host core REST services',
    analytics.get_global_handlers(),
    analytics.get_namespaced_handlers() +
    data_sources.get_namespaced_handlers() +
    student_labels.get_namespaced_handlers()
    ).enable()

# Collect routes (URL-matching regexes -> handler classes) for modules.
global_routes, namespaced_routes = custom_modules.Registry.get_all_routes()

# Configure routes available at '/%namespace%/' context paths
sites.ApplicationRequestHandler.bind(namespaced_routes)
app_routes = [(r'(.*)', sites.ApplicationRequestHandler)]

# enable Appstats handlers if requested
appstats_routes = []
if appengine_config.gcb_appstats_enabled():
    # pylint: disable-msg=g-import-not-at-top
    import google.appengine.ext.appstats.ui as appstats_ui
    # pylint: enable-msg=g-import-not-at-top
예제 #5
0
from models import data_sources
from models import student_labels
from controllers import utils

import gae_mini_profiler.profiler

# Import, register, & enable modules named in app.yaml's GCB_REGISTERED_MODULES.
appengine_config.import_and_enable_modules()

# Core "module" is always present and registered.
custom_modules.Module(
    'Core REST services', 'A module to host core REST services',
    analytics.get_global_handlers(),
    analytics.get_namespaced_handlers() +
    data_sources.get_namespaced_handlers() +
    student_labels.get_namespaced_handlers()).enable()

# Routes used by App Engine internals.
lifecycle_routes = [('/_ah/start', utils.NoopInstanceLifecycleRequestHandler)]

# Collect routes (URL-matching regexes -> handler classes) for modules.
global_routes, namespaced_routes = custom_modules.Registry.get_all_routes()

# Configure routes available at '/%namespace%/' context paths
sites.ApplicationRequestHandler.bind(namespaced_routes)
app_routes = [(r'(.*)', sites.ApplicationRequestHandler)]

# enable Appstats handlers if requested
appstats_routes = []
if appengine_config.gcb_appstats_enabled():
    # pylint: disable-msg=g-import-not-at-top
예제 #6
0
from models import custom_modules
from models import data_sources
from models import student_labels

from handlers import main_handler, course_handlers, cron_handler

# Import, register, & enable modules named in app.yaml's GCB_REGISTERED_MODULES.
appengine_config.import_and_enable_modules()

# Core "module" is always present and registered.
custom_modules.Module(
    'Core REST services', 'A module to host core REST services',
    analytics.get_global_handlers(),
    analytics.get_namespaced_handlers() +
    data_sources.get_namespaced_handlers() +
    student_labels.get_namespaced_handlers()
    ).enable()

# Collect routes (URL-matching regexes -> handler classes) for modules.
global_routes, namespaced_routes = custom_modules.Registry.get_all_routes()

# Configure routes available at '/%namespace%/' context paths
sites.ApplicationRequestHandler.bind(namespaced_routes)
app_routes = [(r'(.*)', sites.ApplicationRequestHandler)]

# enable Appstats handlers if requested
appstats_routes = []
if appengine_config.gcb_appstats_enabled():
    # pylint: disable-msg=g-import-not-at-top
    import google.appengine.ext.appstats.ui as appstats_ui
    # pylint: enable-msg=g-import-not-at-top