hawat.blueprints.users package

This file contains pluggable module for Hawat web interface containing features related to user account management. These features include:

  • general user account listing

  • detailed user account view

  • creating new user accounts

  • updating existing user accounts

  • deleting existing user accounts

  • enabling existing user accounts

  • disabling existing user accounts

  • adding group memberships

  • removing group memberships

  • rejecting group membership requests

class hawat.blueprints.users.AddManagementView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemObjectRelationView

View for adding group managements.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

classmethod authorize_item_action(**kwargs)[source]

Perform access authorization for current user to particular item.

classmethod change_item(**kwargs)[source]

Hook method: Change given item in any desired way.

Parameters

item – Item to be changed/modified.

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_other

Hook property. This property must be implemented in each subclass to return reference to appropriate model class for other objects and that is based on SQLAlchemy declarative base.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

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 HTML head element and also as the content of page header in h2 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"]) as route and add_url_rule by default.

classmethod validate_item_change(**kwargs)[source]

Perform validation of particular change to given item.

class hawat.blueprints.users.AddMembershipView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemObjectRelationView

View for adding group memberships.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

classmethod authorize_item_action(**kwargs)[source]

Perform access authorization for current user to particular item.

classmethod change_item(**kwargs)[source]

Hook method: Change given item in any desired way.

Parameters

item – Item to be changed/modified.

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_other

Hook property. This property must be implemented in each subclass to return reference to appropriate model class for other objects and that is based on SQLAlchemy declarative base.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

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 HTML head element and also as the content of page header in h2 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"]) as route and add_url_rule by default.

classmethod validate_item_change(**kwargs)[source]

Perform validation of particular change to given item.

hawat.blueprints.users.BLUEPRINT_NAME = 'users'

Name of the blueprint as module global constant.

class hawat.blueprints.users.CreateView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemCreateView

View for creating new user accounts.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

authorization = [<Permission needs={Need(method='role', value='maintainer'), Need(method='role', value='admin')} 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 in hawat.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.

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.

static get_item_form(item)[source]

Hook method. Must return instance of flask_wtf.FlaskForm appropriate for given item class.

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]

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"]) as route and add_url_rule by default.

class hawat.blueprints.users.DeleteView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemDeleteView

View for deleting existing user accounts.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

authorization = [<Permission needs={Need(method='role', value='admin')} 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 in hawat.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.

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.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class hawat.blueprints.users.DisableView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemDisableView

View for disabling user accounts.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

authorization = [<Permission needs={Need(method='role', value='maintainer'), Need(method='role', value='admin')} 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 in hawat.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.

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.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class hawat.blueprints.users.EnableView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemEnableView

View for enabling existing user accounts.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

authorization = [<Permission needs={Need(method='role', value='maintainer'), Need(method='role', value='admin')} 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 in hawat.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.

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_after_action(item)[source]

Hook method. Will be called after successfull action handling tasks.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

classmethod inform_user(account)[source]

Send infomail about user account activation.

methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class hawat.blueprints.users.ListView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemListView

General user account 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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

authorization = [<Permission needs={Need(method='role', value='maintainer'), Need(method='role', value='admin')} 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 in hawat.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.

classmethod get_action_menu()[source]

Get action menu for all listed items.

classmethod get_context_action_menu()[source]

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 HTML head element and also as the content of page header in h2 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"]) as route and add_url_rule by default.

class hawat.blueprints.users.MeView[source]

Bases: ShowView

Detailed user account view for currently logged-in user (profile page).

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

authorization = [<Permission needs={Need(method='role', value='maintainer'), Need(method='role', value='user'), Need(method='role', value='admin'), Need(method='role', value='developer')} 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 in hawat.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.

classmethod authorize_item_action(**kwargs)[source]

Perform access authorization for current user to particular item.

dispatch_request()[source]

Mandatory interface required by the flask.views.View.dispatch_request(). Will be called by the Flask framework to service the request.

Single item with given unique identifier will be retrieved from database and injected into template to be displayed to the user.

classmethod get_breadcrumbs_menu()[source]

Get breadcrumbs menu.

classmethod get_menu_title(**kwargs)[source]

Implementation of hawat.view.BaseView.get_menu_title().

classmethod get_view_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

classmethod get_view_name()[source]

Implementation of hawat.view.BaseView.get_view_name().

classmethod get_view_template()[source]

Return Jinja2 template file that should be used for rendering the view content. This default implementation works only in case the view class was properly registered into the parent blueprint/module with hawat.app.hawatBlueprint.register_view_class() method.

Returns

Jinja2 template file to use to render the view.

Return type

str

classmethod get_view_title(**kwargs)[source]

Implementation of hawat.view.BaseView.get_view_title().

classmethod get_view_url(**kwargs)[source]

Implementation of hawat.view.BaseView.get_view_url().

methods: ClassVar[Optional[Collection[str]]] = ['GET']

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class hawat.blueprints.users.RejectMembershipView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemObjectRelationView

View for rejecting group membership requests.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

classmethod authorize_item_action(**kwargs)[source]

Perform access authorization for current user to particular item.

classmethod change_item(**kwargs)[source]

Hook method: Change given item in any desired way.

Parameters

item – Item to be changed/modified.

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_other

Hook property. This property must be implemented in each subclass to return reference to appropriate model class for other objects and that is based on SQLAlchemy declarative base.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

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 HTML head element and also as the content of page header in h2 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"]) as route and add_url_rule by default.

classmethod validate_item_change(**kwargs)[source]

Perform validation of particular change to given item.

class hawat.blueprints.users.RemoveManagementView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemObjectRelationView

View for removing group managements.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

classmethod authorize_item_action(**kwargs)[source]

Perform access authorization for current user to particular item.

classmethod change_item(**kwargs)[source]

Hook method: Change given item in any desired way.

Parameters

item – Item to be changed/modified.

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_other

Hook property. This property must be implemented in each subclass to return reference to appropriate model class for other objects and that is based on SQLAlchemy declarative base.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

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 HTML head element and also as the content of page header in h2 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"]) as route and add_url_rule by default.

classmethod validate_item_change(**kwargs)[source]

Perform validation of particular change to given item.

class hawat.blueprints.users.RemoveMembershipView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemObjectRelationView

View for removing group memberships.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

classmethod authorize_item_action(**kwargs)[source]

Perform access authorization for current user to particular item.

classmethod change_item(**kwargs)[source]

Hook method: Change given item in any desired way.

Parameters

item – Item to be changed/modified.

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_other

Hook property. This property must be implemented in each subclass to return reference to appropriate model class for other objects and that is based on SQLAlchemy declarative base.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

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 HTML head element and also as the content of page header in h2 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"]) as route and add_url_rule by default.

classmethod validate_item_change(**kwargs)[source]

Perform validation of particular change to given item.

class hawat.blueprints.users.ShowView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemShowView

Detailed user account 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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

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.

classmethod get_action_menu()[source]

Get action menu for particular item.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

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"]) as route and add_url_rule by default.

class hawat.blueprints.users.UpdateView[source]

Bases: HTMLMixin, SQLAlchemyMixin, ItemUpdateView

View for updating existing user accounts.

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 in hawat.app.hawatBlueprint.register_view_class() the view will be automatically decorated with flask_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 or False.

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.

static get_item_form(item)[source]

Hook method. Must return instance of flask_wtf.FlaskForm appropriate for given item class.

classmethod get_menu_legend(**kwargs)[source]

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_icon()[source]

Implementation of hawat.view.BaseView.get_view_icon().

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"]) as route and add_url_rule by default.

class hawat.blueprints.users.UsersBlueprint(name, import_name, **kwargs)[source]

Bases: HawatBlueprint

Pluggable module - user account management (users).

classmethod get_module_title()[source]

Get human readable name for this blueprint/module.

Returns

Name (short summary) of the blueprint/module.

Return type

str

register_app(app)[source]

Hook method: Custom callback, which will be called from hawat.app.Hawat.register_blueprint() method and which can perform additional tweaking of Hawat application object.

Parameters

app (hawat.app.Hawat) – Application object.

hawat.blueprints.users.get_blueprint()[source]

Mandatory interface for hawat.Hawat and factory function. This function must return a valid instance of hawat.app.HawatBlueprint or flask.Blueprint.

Subpackages