module apps.qcm.qcm_app

Inheritance diagram of mathenjeu.apps.qcm.qcm_app

Short summary

module mathenjeu.apps.qcm.qcm_app

Starts an application.

source on GitHub

Classes

class

truncated documentation

QCMApp

Implements routes for a web application.

Methods

method

truncated documentation

__init__

answer

Captures an answer.

cleanup

Cleans up.

event

This route does not return anything interesting except a blank page, but it logs

lastpage

Defines the last page.

main

Defines the main page.

not_found

Returns an HTTP 404 page.

on_error

An example error.

page_context

Returns the page context before applying any template.

qcm

Defines the main page.

server_error

Returns an HTTP 500 page.

startup

Startups.

unknown_game

Returns an answer for somebody looking to access the questions without being authentified.

unlogged_response

Returns an answer for somebody looking to access the questions without being authentified.

Documentation

Starts an application.

source on GitHub

class mathenjeu.apps.qcm.qcm_app.QCMApp(secret_log=None, folder='.', max_age=1209600, cookie_key=None, cookie_name='mathenjeu', cookie_domain='127.0.0.1', cookie_path='/', title='Web Application MathEnJeu', short_title='MathEnJeu', page_doc='http://www.xavierdupre.fr/app/mathenjeu/helpsphinx/', secure=False, display=None, fct_game=None, games=None, middles=None, debug=False, userpwd=None)[source]

Bases : mathenjeu.apps.common.log_app.LogApp, mathenjeu.apps.common.auth_app.AuthentificationAnswers

Implements routes for a web application.

Which server to server starlette application?

starlette does not implement a webserver, it only provides a way to map urls to answers and to interect with the user. To launch a server serving starlette applications, there is module uvicorn but it does not implement a secured connection. There is hypercorn which should support it. Other alternatives are described on starlette/installation.

source on GitHub

Paramètres
  • secret_log – to encrypt log (None to ignore)

  • folder – folder where to write the logs (None to disable the logging)

  • max_age – cookie’s duration in seconds

  • cookie_key – to encrypt information in the cookie (cannot be None)

  • cookie_name – name of the session cookie

  • cookie_domain – cookie is valid for this path only, also defines the domain of the web app (its url)

  • cookie_path – path of the cookie once storeds

  • secure – use secured connection for cookies

  • title – title

  • short_title – short application title

  • page_doc – documentation page

  • display – display such as DisplayQuestionChoiceHTML (default value)

  • fct_game – function lambda name: ActivityGroup

  • games – defines which games is available as a dictionary { game_id: (game name, first page id) }

  • middles – middles ware, list of couple [(class, **kwargs)] where kwargs are the parameter constructor

  • userpwd – users are authentified with any alias but a common password

  • debug – display debug information (starlette option)

source on GitHub

__init__(secret_log=None, folder='.', max_age=1209600, cookie_key=None, cookie_name='mathenjeu', cookie_domain='127.0.0.1', cookie_path='/', title='Web Application MathEnJeu', short_title='MathEnJeu', page_doc='http://www.xavierdupre.fr/app/mathenjeu/helpsphinx/', secure=False, display=None, fct_game=None, games=None, middles=None, debug=False, userpwd=None)[source]
Paramètres
  • secret_log – to encrypt log (None to ignore)

  • folder – folder where to write the logs (None to disable the logging)

  • max_age – cookie’s duration in seconds

  • cookie_key – to encrypt information in the cookie (cannot be None)

  • cookie_name – name of the session cookie

  • cookie_domain – cookie is valid for this path only, also defines the domain of the web app (its url)

  • cookie_path – path of the cookie once storeds

  • secure – use secured connection for cookies

  • title – title

  • short_title – short application title

  • page_doc – documentation page

  • display – display such as DisplayQuestionChoiceHTML (default value)

  • fct_game – function lambda name: ActivityGroup

  • games – defines which games is available as a dictionary { game_id: (game name, first page id) }

  • middles – middles ware, list of couple [(class, **kwargs)] where kwargs are the parameter constructor

  • userpwd – users are authentified with any alias but a common password

  • debug – display debug information (starlette option)

source on GitHub

async answer(request)[source]

Captures an answer.

@param request request @return response

cleanup()[source]

Cleans up.

source on GitHub

async event(request)[source]

This route does not return anything interesting except a blank page, but it logs

async lastpage(request)[source]

Defines the last page.

async main(request)[source]

Defines the main page.

async not_found(request, exc)[source]

Returns an HTTP 404 page.

async on_error(request)[source]

An example error.

page_context(**kwargs)[source]

Returns the page context before applying any template.

Paramètres

kwargs – arguments

Renvoie

parameters

source on GitHub

async qcm(request)[source]

Defines the main page.

async server_error(request, exc)[source]

Returns an HTTP 500 page.

startup()[source]

Startups.

source on GitHub

unknown_game(request, session)[source]

Returns an answer for somebody looking to access the questions without being authentified.

source on GitHub

unlogged_response(request, session)[source]

Returns an answer for somebody looking to access the questions without being authentified.

source on GitHub