condition_functions#

The collection of preexisting condition functions.

Functions embedded in Condition that, when called and return a True value, trigger the transitions.

baf.library.transition.condition_functions.file_type(session, params)[source]#

This function only returns True if a user sent a file of an allowed type.

Parameters:
  • session (Session) – the current user session

  • params (dict) – the function parameters

Returns:

True if the user has sent a file and the received file type corresponds to the allowed types as defined in “allowed_types”

Return type:

bool

baf.library.transition.condition_functions.form_submitted(session, params)[source]#

This function returns True when the current event is a GUI form submission.

Optionally, only submissions from a specific GUI (identified by form_id) are matched. If no form_id is given, any form submission triggers the transition.

Parameters:
  • session (Session) – the current user session

  • params (dict) – the function parameters. May contain 'form_id' (str) to filter by a specific GUI message id.

Returns:

True if the event is a form submission (and matches the optional form_id)

Return type:

bool

baf.library.transition.condition_functions.intent_matched(session, params)[source]#

This function checks if 2 intents are the same, used for intent matching checking.

Parameters:
  • session (Session) – the current user session

  • params (dict) – the function parameters

Returns:

True if the 2 intents are the same, false otherwise

Return type:

bool

baf.library.transition.condition_functions.variable_matches_operation(session, params)[source]#

This function checks if for a specific comparison operation, using a stored session value and a given target value, returns true.

Parameters:
  • session (Session) – the current user session

  • params (dict) – the function parameters

Returns:

True if the comparison operation of the given values returns true

Return type:

bool