.. _l-methods: Methods ======= .. contents:: :local: :depth: 1 Summary +++++++ +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | method | class parent | truncated documentation | +==================================================================================================+===========================+=======================================================================================================================+ | :py:meth:`__call__ ` | AuthMount | Checks the user is authenticated, falls back in the previous behavior, otherwise redirect to the authentification ... | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__call__ ` | AuthStaticFiles | The ASGI entry point. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__getitem__ ` | Activity | Returns the value associated to a field. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__getitem__ ` | ActivityGroup | Retrieves the question. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__getitem__ ` | Base | Returns the value associated to a field. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__getitem__ ` | Display | Returns the value associated to a field. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__getitem__ ` | LanguageBase | Returns the value associated to a field. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__getitem__ ` | Notion | Returns the value associated to a field. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | QuestionChoice | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | Activity | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | ActivityGroup | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | Base | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | Display | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | LanguageBase | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | Notion | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | AuthentificationAnswers | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | LogApp | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | DisplayQuestionChoiceHTML | constructor | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | QCMApp | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | ServerHypercorn | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | AuthMount | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | StaticApp | | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__iter__ ` | ActivityGroup | To iterate on activities. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__len__ ` | ActivityGroup | Returns the number of activities. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__repr__ ` | Activity | Usual | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__repr__ ` | ActivityGroup | Usual | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__repr__ ` | Base | Usual | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__repr__ ` | Display | Usual | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__repr__ ` | LanguageBase | Usual | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__repr__ ` | Notion | Usual | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`answer ` | QCMApp | Captures an answer. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`authenticate ` | AuthentificationAnswers | Authentification. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`authentify_user ` | AuthentificationAnswers | Overwrites this method to allow or reject users. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`cleanup ` | QCMApp | Cleans up. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`cleanup ` | StaticApp | Cleans up. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`event ` | QCMApp | This route does not return anything interesting except a blank page, but it logs | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`event ` | StaticApp | This route does not return anything interesting except a blank page, but it logs | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`expected_answers ` | ActivityGroup | Returns the expected answers aliases. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`get_app_session ` | AuthMount | Retrieves the :epkg:`starlette` application and the session. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`get_app_session ` | AuthStaticFiles | Retrieves the :epkg:`starlette` application and the session. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`get_app_session ` | _CommonMethods | Retrieves the :epkg:`starlette` application and the session. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`get_context ` | DisplayQuestionChoiceHTML | Renders a question specified as QCM. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`get_display_item ` | ActivityGroup | Returns a displayable number. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`get_next ` | ActivityGroup | Computes the next question or returns None if does not exist. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`get_previous ` | ActivityGroup | Computes the previous question or returns None if does not exist. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`get_session ` | AuthentificationAnswers | Retrieves the session. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`hash_pwd ` | AuthentificationAnswers | Hashes a password. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`is_allowed ` | AuthentificationAnswers | Checks that a user is allowed. Returns None if it is allowed, otherwise an page with an error message. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`lastpage ` | QCMApp | Defines the last page. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`log_any ` | LogApp | Logs information. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`log_event ` | LogApp | Logs information about events. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`login ` | AuthentificationAnswers | Login page. If paramater *returnto* is specified in the url, the user will go to this page after being logged. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`logout ` | AuthentificationAnswers | Logout page. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`main ` | QCMApp | Defines the main page. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`main ` | StaticApp | Defines the main page. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`not_found ` | QCMApp | Returns an :epkg:`HTTP 404` page. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`not_found ` | StaticApp | Returns an :epkg:`HTTP 404` page. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`on_error ` | QCMApp | An example error. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`on_error ` | StaticApp | An example error. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`page_context ` | QCMApp | Returns the page context before applying any template. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`page_context ` | StaticApp | Returns the page context before applying any template. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`qcm ` | QCMApp | Defines the main page. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`run ` | ServerHypercorn | Starts the server. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`save_session ` | AuthentificationAnswers | Saves the session to the response in a secure cookie. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`server_error ` | QCMApp | Returns an :epkg:`HTTP 500` page. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`server_error ` | StaticApp | Returns an :epkg:`HTTP 500` page. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`startup ` | QCMApp | Startups. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`startup ` | StaticApp | Startups. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`to_dict ` | Activity | Returns all values as a dictionary. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`to_dict ` | ActivityGroup | Returns all values as a dictionary. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`to_dict ` | Base | Returns all values as a dictionary. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`to_dict ` | Display | Returns all values as a dictionary. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`to_dict ` | LanguageBase | Returns all values as a dictionary. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`to_dict ` | Notion | Returns all values as a dictionary. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`unknown_game ` | QCMApp | Returns an answer for somebody looking to access the questions without being authentified. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`unlogged_response ` | QCMApp | Returns an answer for somebody looking to access the questions without being authentified. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :meth:`unlogged_response ` | StaticApp | Returns an answer for somebody looking to access the questions without being authentified. | +--------------------------------------------------------------------------------------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------+