inginious.frontend.pages package

Frontend pages (controllers)

Subpackages

Submodules

inginious.frontend.pages.group module

Index page

class inginious.frontend.pages.group.GroupPage[source]

Bases: inginious.frontend.pages.utils.INGIniousAuthPage

Group page

GET_AUTH(courseid)[source]

GET request

methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

inginious.frontend.pages.course module

Course page

class inginious.frontend.pages.course.CoursePage[source]

Bases: inginious.frontend.pages.utils.INGIniousAuthPage

Course page

GET_AUTH(courseid)[source]

GET request

POST_AUTH(courseid)[source]

POST request

get_course(courseid)[source]

Return the course

methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

preview_allowed(courseid)[source]

If this function returns True, the auth check is disabled. Override this function with a custom check if needed.

show_page(course)[source]

Prepares and shows the course page

inginious.frontend.pages.course.handle_course_unavailable(app_homepath, template_helper, user_manager, course)[source]

Displays the course_unavailable page or the course registration page

inginious.frontend.pages.index module

Index page

class inginious.frontend.pages.index.IndexPage[source]

Bases: inginious.frontend.pages.utils.INGIniousStaticPage

Index page

GET()[source]

Display main course list page

POST()[source]

Display main course list page

methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

inginious.frontend.pages.maintenance module

Maintenance page

class inginious.frontend.pages.maintenance.MaintenancePage[source]

Bases: flask.views.MethodView

Maintenance page

get(path=None)[source]

GET request

methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

post(path=None)[source]

POST request

inginious.frontend.pages.tasks module

Task page

class inginious.frontend.pages.tasks.BaseTaskPage(calling_page)[source]

Bases: object

Display a task (and allow to reload old submission/file uploaded during a submission)

GET(courseid, taskid, is_LTI)[source]

GET request

POST(courseid, taskid, isLTI)[source]

POST a new submission

preview_allowed(courseid, taskid)[source]
submission_to_json(task, data, debug, reloading=False, replace=False, tags=None)[source]

Converts a submission to json (keeps only needed fields)

class inginious.frontend.pages.tasks.TaskPage[source]

Bases: inginious.frontend.pages.utils.INGIniousAuthPage

GET_AUTH(courseid, taskid)[source]
POST_AUTH(courseid, taskid)[source]
methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

preview_allowed(courseid, taskid)[source]

If this function returns True, the auth check is disabled. Override this function with a custom check if needed.

class inginious.frontend.pages.tasks.TaskPageStaticDownload[source]

Bases: inginious.frontend.pages.utils.INGIniousPage

Allow to download files stored in the task folder

GET(courseid, taskid, path)[source]

GET request

is_lti_page()[source]

True if the current page allows LTI sessions. False else.

methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

inginious.frontend.pages.utils module

Some utils for all the pages

class inginious.frontend.pages.utils.INGIniousAdministratorPage[source]

Bases: inginious.frontend.pages.utils.INGIniousAuthPage

Augmented version of INGIniousAuthPage that checks if user is administrator (superadmin).

GET(*args, **kwargs)[source]

Checks if user is superadmin and calls GET_AUTH or performs logout. Otherwise, returns the login template.

POST(*args, **kwargs)[source]

Checks if user is superadmin and calls POST_AUTH. Otherwise, returns the forbidden template.

methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class inginious.frontend.pages.utils.INGIniousAuthPage[source]

Bases: inginious.frontend.pages.utils.INGIniousPage

Augmented version of INGIniousPage that checks if user is authenticated.

GET(*args, **kwargs)[source]

Checks if user is authenticated and calls GET_AUTH or performs logout. Otherwise, returns the login template.

GET_AUTH(*args, **kwargs)[source]
POST(*args, **kwargs)[source]

Checks if user is authenticated and calls POST_AUTH or performs login and calls GET_AUTH. Otherwise, returns the login template.

POST_AUTH(*args, **kwargs)[source]
methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

preview_allowed(*args, **kwargs)[source]

If this function returns True, the auth check is disabled. Override this function with a custom check if needed.

class inginious.frontend.pages.utils.INGIniousPage[source]

Bases: flask.views.MethodView

A base for all the pages of the INGInious webapp. Contains references to the PluginManager, the CourseFactory, and the SubmissionManager

property app

Returns the web application singleton

property backup_dir: str

Backup directory

Return type

str

property client: inginious.client.client.Client

Returns the INGInious client

Return type

Client

property course_factory: inginious.frontend.course_factory.CourseFactory

Returns the course factory singleton

Return type

CourseFactory

property database: pymongo.database.Database

Returns the database singleton

Return type

Database

property default_allowed_file_extensions: List[str]

List of allowed file extensions

Return type

List[str]

property default_max_file_size: int

Default maximum file size for upload

Return type

int

property environment_types: Dict[str, inginious.frontend.environment_types.env_type.FrontendEnvType]

Available environment types

Return type

Dict[str, FrontendEnvType]

property environments: Dict[str, List[str]]

Available environments

Return type

Dict[str, List[str]]

get(sessionid, *args, **kwargs)[source]
property gridfs: gridfs.GridFS

Returns the GridFS singleton

Return type

GridFS

property is_lti_page

True if the current page allows LTI sessions. False else.

property logger: logging.Logger

Logger

Return type

Logger

property lti_outcome_manager: inginious.frontend.lti_outcome_manager.LTIOutcomeManager

Returns the LTIOutcomeManager singleton

Return type

LTIOutcomeManager

methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

property plugin_manager: inginious.frontend.plugin_manager.PluginManager

Returns the plugin manager singleton

Return type

PluginManager

post(sessionid, *args, **kwargs)[source]
property submission_manager: inginious.frontend.submission_manager.WebAppSubmissionManager

Returns the submission manager singleton

Return type

WebAppSubmissionManager

property task_factory: inginious.frontend.task_factory.TaskFactory

Returns the task factory singleton

Return type

TaskFactory

property template_helper: inginious.frontend.template_helper.TemplateHelper

Returns the Template Helper singleton

Return type

TemplateHelper

property user_manager: inginious.frontend.user_manager.UserManager

Returns the user manager singleton

Return type

UserManager

property webdav_host: str

True if webdav is available

Return type

str

Returns the link to the web terminal

Return type

str

class inginious.frontend.pages.utils.INGIniousStaticPage[source]

Bases: inginious.frontend.pages.utils.INGIniousPage

GET(pageid)[source]
POST(pageid)[source]
cache = {}
methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

show_page(page)[source]
class inginious.frontend.pages.utils.LogOutPage[source]

Bases: inginious.frontend.pages.utils.INGIniousAuthPage

GET_AUTH(*args, **kwargs)[source]
POST_AUTH(*args, **kwargs)[source]
methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class inginious.frontend.pages.utils.SignInPage[source]

Bases: inginious.frontend.pages.utils.INGIniousAuthPage

GET()[source]

Checks if user is authenticated and calls GET_AUTH or performs logout. Otherwise, returns the login template.

GET_AUTH(*args, **kwargs)[source]
POST_AUTH(*args, **kwargs)[source]
methods: ClassVar[Optional[Collection[str]]] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

inginious.frontend.pages.utils.generate_user_selection_box(user_manager, render_func, current_users, course_id, name, id, placeholder=None, single=False)[source]

Returns the HTML for a user selection box. The user using the box must have admin/tutors rights on the course with id course_id.

The box will return, when submitted using a form, a list of usernames separated by commas, under the given name.

NB: this function is available in the templates directly as “$user_selection_box(current_users, course_id, name, id)”. You must ignore the first argument (template_helper) in the templates.

Parameters
  • user_manager (UserManager) – UserManager instance

  • render_func – template generator

  • current_users (List[str]) – a list of usernames currently selected

  • course_id (str) – the course id

  • name (str) – HTML name given to the box

  • id (str) – HTML id given to the box

  • single – False for multiple user selection, True for single user selection

Returns

HTML code for the box

inginious.frontend.pages.utils.register_utils(database, user_manager, template_helper)[source]

Registers utils in the template helper