hawat.base module

class hawat.base.HawatApp(import_name, **kwargs)[source]

Bases: vial.app.Vial

Custom implementation of flask.Flask class. This class extends the capabilities of the base class with following additional features:

Configuration based blueprint registration

The application configuration file contains a directive describing list of requested blueprints/modules, that should be registered into the application. This enables administrator to very easily fine tune the application setup for each installation. See the hawat.base.HawatApp.register_blueprints() for more information on the topic.

Application main menu management

The application provides three distinct menus, that are at a disposal for blueprint/module designer.

Mentat config access

The application provides access to Mentat`s core configurations.

get_csag(group_name)[source]

Return list of all registered context search actions for given group name (CSAG: Context Search Action Group).

Parameters

group_name (str) – Name of the group.

Returns

List of all registered context search actions.

Return type

list

get_oads(group_name)[source]

Return list of all registered object additional data services for given object group name (OADS: Additional Object Data Service).

Parameters

group_name (str) – Name of the group.

Returns

List of all object additional data services.

Return type

list

property mconfig

Return Mentat specific configuration sub-dictionary.

set_csag(group_name, title, view_class, params_builder)[source]

Store new context search action for given group name (CSAG: Context Search Action Group).

Parameters
  • group_name (str) – Name of the group.

  • title (str) – Title for the search action.

  • view_class (class) – Associated view class.

  • params_builder (URLParamsBuilder) – URL parameter builder for this action.

set_csag_url(group_name, title, icon, url_builder)[source]

Store new URL based context search action for given group name (CSAG: Context Search Action Group).

Parameters
  • group_name (str) – Name of the group.

  • title (str) – Title for the search action.

  • icon (str) – Icon for the search action.

  • url_builder (func) – URL builder for this action.

set_oads(group_name, view_class, params_builder)[source]

Store new object additional data services for given object group name (OADS: Additional Object Data Service).

Parameters
  • group_name (str) – Name of the group.

  • view_class (class) – Associated view class.

  • params_builder (URLParamsBuilder) – URL parameter builder for this action.

setup_app()[source]

Perform setup of the whole application.

class hawat.base.PsycopgMixin[source]

Bases: object

Mixin class providing generic interface for interacting with SQL database backend through SQLAlchemy library.

SEARCH_QUERY_QUOTA = 5
SEARCH_QUERY_QUOTA_CHECK = True
fetch(item_id)[source]

Fetch item with given primary identifier from the database.

static get_db()[source]

Get database connection service.

Returns

database connection service.

Return type

mentat.services.eventstorage.EventStorageService

static get_qname()[source]

Get unique name for the event select query.

static get_qtype()[source]

Get type of the event select query.

static parse_qname(qname)[source]

Get unique name for the event select query.

search(form_args)[source]

Perform actual search of IDEA events using provided query arguments.

Parameters

form_args (dict) – Search query arguments.

Returns

Tuple containing number of items as integer and list of searched items.

Return type

tuple