hawat.blueprints.filters package
This pluggable module provides access to reporting filter management features. These features include:
general reporting filter listing
detailed reporting filter view
creating new reporting filters
updating existing reporting filters
deleting existing reporting filters
- hawat.blueprints.filters.BLUEPRINT_NAME = 'filters'
Name of the blueprint as module global constant.
- class hawat.blueprints.filters.CreateForView[source]
Bases:
HTMLMixin
,SQLAlchemyMixin
,ItemCreateForView
View for creating new reporting filters for given groups.
- static add_parent_to_item(item, parent)[source]
Hook method. Use given parent object for given item object. The actual operation to realize this relationship is highly dependent on current circumstance. It is up to the developer to perform correct set of actions to implement parent - child relationship for particular object types.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- classmethod authorize_item_action(**kwargs)[source]
Perform access authorization for current user to particular item.
- property dbchlogmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- property dbmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- property dbmodel_par
Hook property. This property must be implemented in each subclass to return reference to appropriate model class for parent objects and that is based on SQLAlchemy declarative base.
- do_before_response(**kwargs)[source]
This method will be called just before generating the response. By providing some meaningfull implementation you can use it for some simple item and response context mangling tasks.
- Parameters
kwargs – Custom additional arguments.
- static get_item_form(item)[source]
Hook method. Must return instance of
flask_wtf.FlaskForm
appropriate for given item class.
Return menu entry legend for the view (menu entry hover tooltip).
Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry legend for the view.
- Return type
str
Return menu entry title for the view.
Default implementation returns the return value of
hawat.view.BaseView.get_view_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry title for the view.
- Return type
str
- static get_message_cancel(**kwargs)[source]
Hook method. Must return text for flash message in case of action cancel. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_failure(**kwargs)[source]
Hook method. Must return text for flash message in case of action failure. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_success(**kwargs)[source]
Hook method. Must return text for flash message in case of action success. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- classmethod get_view_icon()[source]
Implementation of
hawat.view.BaseView.get_view_icon()
.
- classmethod get_view_title(**kwargs)[source]
Return title for the view, that will be displayed in the
title
tag of HTMLhead
element and also as the content of page header inh2
tag.Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Title for the view.
- Return type
str
- classmethod get_view_url(**kwargs)[source]
Implementation of
hawat.view.BaseView.get_view_url()
.
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- module_name_par = 'groups'
- class hawat.blueprints.filters.CreateView[source]
Bases:
HTMLMixin
,SQLAlchemyMixin
,ItemCreateView
View for creating new reporting filters for any groups.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- classmethod authorize_item_action(**kwargs)[source]
Perform access authorization for current user to particular item.
- property dbchlogmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- property dbmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- do_before_response(**kwargs)[source]
This method will be called just before generating the response. By providing some meaningfull implementation you can use it for some simple item and response context mangling tasks.
- Parameters
kwargs – Custom additional arguments.
- static get_item_form(item)[source]
Hook method. Must return instance of
flask_wtf.FlaskForm
appropriate for given item class.
Implementation of
hawat.view.BaseView.get_menu_title()
.
- static get_message_cancel(**kwargs)[source]
Hook method. Must return text for flash message in case of action cancel. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_failure(**kwargs)[source]
Hook method. Must return text for flash message in case of action failure. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_success(**kwargs)[source]
Hook method. Must return text for flash message in case of action success. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- classmethod get_view_title(**kwargs)[source]
Implementation of
hawat.view.BaseView.get_view_title()
.
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.filters.DeleteView[source]
Bases:
HTMLMixin
,SQLAlchemyMixin
,ItemDeleteView
View for deleting existing reporting filters.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- classmethod authorize_item_action(**kwargs)[source]
Perform access authorization for current user to particular item.
- property dbchlogmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- property dbmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
Return menu entry legend for the view (menu entry hover tooltip).
Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry legend for the view.
- Return type
str
- static get_message_cancel(**kwargs)[source]
Hook method. Must return text for flash message in case of action cancel. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_failure(**kwargs)[source]
Hook method. Must return text for flash message in case of action failure. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_success(**kwargs)[source]
Hook method. Must return text for flash message in case of action success. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.filters.DisableView[source]
Bases:
HTMLMixin
,SQLAlchemyMixin
,ItemDisableView
View for disabling existing reporting filters.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- classmethod authorize_item_action(**kwargs)[source]
Perform access authorization for current user to particular item.
- property dbchlogmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- property dbmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
Return menu entry legend for the view (menu entry hover tooltip).
Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry legend for the view.
- Return type
str
- static get_message_cancel(**kwargs)[source]
Hook method. Must return text for flash message in case of action cancel. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_failure(**kwargs)[source]
Hook method. Must return text for flash message in case of action failure. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_success(**kwargs)[source]
Hook method. Must return text for flash message in case of action success. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.filters.EnableView[source]
Bases:
HTMLMixin
,SQLAlchemyMixin
,ItemEnableView
View for enabling existing reporting filters.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- classmethod authorize_item_action(**kwargs)[source]
Perform access authorization for current user to particular item.
- property dbchlogmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- property dbmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
Return menu entry legend for the view (menu entry hover tooltip).
Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry legend for the view.
- Return type
str
- static get_message_cancel(**kwargs)[source]
Hook method. Must return text for flash message in case of action cancel. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_failure(**kwargs)[source]
Hook method. Must return text for flash message in case of action failure. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_success(**kwargs)[source]
Hook method. Must return text for flash message in case of action success. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.filters.FiltersBlueprint(name, import_name, **kwargs)[source]
Bases:
HawatBlueprint
Pluggable module - reporting filter management (filters).
- class hawat.blueprints.filters.ListView[source]
Bases:
HTMLMixin
,SQLAlchemyMixin
,ItemListView
General reporting filter listing.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- authorization = [<Permission needs={Need(method='role', value='admin'), Need(method='role', value='maintainer')} excludes=set()>]
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authorization. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated with given authorization decorators.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a list variable that must contain list of desired decorators.
- static build_query(query, model, form_args)[source]
Hook method. Modify given query according to the given arguments.
- property dbmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
Get action menu for all listed items.
Get context action menu for particular single item.
- static get_search_form(request_args)[source]
Must return instance of
flask_wtf.FlaskForm
appropriate for searching given type of items.
- classmethod get_view_title(**kwargs)[source]
Return title for the view, that will be displayed in the
title
tag of HTMLhead
element and also as the content of page header inh2
tag.Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Title for the view.
- Return type
str
- methods: ClassVar[Optional[Collection[str]]] = ['GET']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.filters.PlaygroundView[source]
Bases:
HTMLMixin
,RenderableView
Reporting filter playground view.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- dispatch_request()[source]
Mandatory interface required by the
flask.views.View.dispatch_request()
. Will be called by the Flask framework to service the request.
Return menu entry legend for the view (menu entry hover tooltip).
Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry legend for the view.
- Return type
str
Return menu entry title for the view.
Default implementation returns the return value of
hawat.view.BaseView.get_view_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry title for the view.
- Return type
str
- classmethod get_view_icon()[source]
Return menu entry icon name for the view. Given name will be used as index to built-in icon registry.
Default implementation generates the icon name by concatenating the prefix
module-
with module name.- Returns
View icon.
- Return type
str
- classmethod get_view_name()[source]
Return unique name for the view. Name must be unique in the namespace of parent blueprint/module and should contain only characters
[a-z0-9]
. It will be used for generating endpoint name for the view.This method does not have any default implementation and must be overridden by a subclass.
- Returns
Name for the view.
- Return type
str
- classmethod get_view_title(**kwargs)[source]
Return title for the view, that will be displayed in the
title
tag of HTMLhead
element and also as the content of page header inh2
tag.Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Title for the view.
- Return type
str
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.filters.ShowView[source]
Bases:
HTMLMixin
,SQLAlchemyMixin
,ItemShowView
Detailed reporting filter view.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- classmethod authorize_item_action(**kwargs)[source]
Perform access authorization for current user to particular item.
- property dbmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- do_before_response(**kwargs)[source]
This method will be called just before generating the response. By providing some meaningfull implementation you can use it for some simple item and response context mangling tasks.
- Parameters
kwargs – Custom additional arguments.
Get action menu for particular item.
Return menu entry legend for the view (menu entry hover tooltip).
Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry legend for the view.
- Return type
str
- classmethod get_view_title(**kwargs)[source]
Implementation of
hawat.view.BaseView.get_view_title()
.
- methods: ClassVar[Optional[Collection[str]]] = ['GET']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.filters.UpdateView[source]
Bases:
HTMLMixin
,SQLAlchemyMixin
,ItemUpdateView
View for updating existing reporting filters.
- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- classmethod authorize_item_action(**kwargs)[source]
Perform access authorization for current user to particular item.
- property dbchlogmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- property dbmodel
This property must be implemented in each subclass to return reference to appropriate model class based on SQLAlchemy declarative base.
- do_before_response(**kwargs)[source]
This method will be called just before generating the response. By providing some meaningfull implementation you can use it for some simple item and response context mangling tasks.
- Parameters
kwargs – Custom additional arguments.
- static get_item_form(item)[source]
Hook method. Must return instance of
flask_wtf.FlaskForm
appropriate for given item class.
Return menu entry legend for the view (menu entry hover tooltip).
Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry legend for the view.
- Return type
str
- static get_message_cancel(**kwargs)[source]
Hook method. Must return text for flash message in case of action cancel. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_failure(**kwargs)[source]
Hook method. Must return text for flash message in case of action failure. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- static get_message_success(**kwargs)[source]
Hook method. Must return text for flash message in case of action success. The text may contain HTML characters and will be passed to
flask.Markup
before being used, so to certain extend you may emphasize and customize the output.
- classmethod get_view_title(**kwargs)[source]
Implementation of
hawat.view.BaseView.get_view_title()
.
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- hawat.blueprints.filters.get_blueprint()[source]
Mandatory interface for
hawat.Hawat
and factory function. This function must return a valid instance ofhawat.app.HawatBlueprint
orflask.Blueprint
.
- hawat.blueprints.filters.process_rule(item)[source]
Process given event report filtering rule and generate advanced single rule string from simple filtering form data.
- hawat.blueprints.filters.tree_check(rule_tree, data)[source]
Check given event against given rule tree.
- hawat.blueprints.filters.tree_html(rule_tree)[source]
Render given rule object tree to HTML formatted content.
Subpackages
Submodules
- hawat.blueprints.filters.forms module
AdminFilterForm
BaseFilterForm
BaseFilterForm.cancel
BaseFilterForm.categories
BaseFilterForm.description
BaseFilterForm.detectors
BaseFilterForm.enabled
BaseFilterForm.filter
BaseFilterForm.name
BaseFilterForm.preview
BaseFilterForm.sources
BaseFilterForm.submit
BaseFilterForm.type
BaseFilterForm.valid_from
BaseFilterForm.valid_to
FilterSearchForm
PlaygroundFilterForm
check_event()
check_filter()
get_available_groups()