Ejemplo n.º 1
0
from models import analytics
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
Ejemplo n.º 2
0
from models import student_work


# Set the default users service before we do anything else.
users.UsersServiceManager.set(users.AppEnginePassthroughUsersService)

# 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.register_core_module(
    analytics.get_global_handlers() +
    models.get_global_handlers() +
    sites.get_global_handlers(),
    analytics.get_namespaced_handlers() +
    data_sources.get_namespaced_handlers() +
    utils.get_namespaced_handlers())

# Register core components for data removal.
models.register_for_data_removal()
student_work.register_for_data_removal()

# Register core handler for user-unregister commanded from add-on modules.
models.StudentLifecycleObserver.EVENT_CALLBACKS[
    models.StudentLifecycleObserver.EVENT_UNENROLL_COMMANDED][
        appengine_config.CORE_MODULE_NAME] = (
            models.StudentProfileDAO.unregister_user)

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