hawat.blueprints.networks package

This pluggable module provides access to network record management features. These features include:

  • general network record listing

  • detailed network record view

  • creating new network records

  • updating existing network records

  • deleting existing network records

hawat.blueprints.networks.BLUEPRINT_NAME = 'networks'

Name of the blueprint as module global constant.

class hawat.blueprints.networks.CreateForView[source]

Bases: hawat.view.mixin.HTMLMixin, hawat.view.mixin.SQLAlchemyMixin, hawat.view.ItemCreateForView

View for creating new network records.

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
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.

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

classmethod get_menu_title(**kwargs)[source]

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 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

classmethod get_view_url(**kwargs)[source]

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

methods: Optional[List[str]] = ['GET', 'POST']
module_name_par = 'groups'
class hawat.blueprints.networks.CreateView[source]

Bases: hawat.view.mixin.HTMLMixin, hawat.view.mixin.SQLAlchemyMixin, hawat.view.ItemCreateView

View for creating new network records.

authentication = True
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_title(**kwargs)[source]

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: Optional[List[str]] = ['GET', 'POST']
class hawat.blueprints.networks.DeleteView[source]

Bases: hawat.view.mixin.HTMLMixin, hawat.view.mixin.SQLAlchemyMixin, hawat.view.ItemDeleteView

View for deleting existing network records.

authentication = True
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.

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.

methods: Optional[List[str]] = ['GET', 'POST']
class hawat.blueprints.networks.ListView[source]

Bases: hawat.view.mixin.HTMLMixin, hawat.view.mixin.SQLAlchemyMixin, hawat.view.ItemListView

General network record listing.

authentication = True
authorization = [<Permission needs={Need(method='role', value='maintainer'), Need(method='role', value='admin')} excludes=set()>]
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: Optional[List[str]] = ['GET']
class hawat.blueprints.networks.NetworksBlueprint(name, import_name, **kwargs)[source]

Bases: hawat.base.HawatBlueprint

Pluggable module - network management (networks).

classmethod get_module_title()[source]

Get human readable name for this blueprint/module.

Returns

Name (short summary) of the blueprint/module.

Return type

str

name = None
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.

class hawat.blueprints.networks.ShowView[source]

Bases: hawat.view.mixin.HTMLMixin, hawat.view.mixin.SQLAlchemyMixin, hawat.view.ItemShowView

Detailed network record view.

authentication = True
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_title(**kwargs)[source]

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

methods: Optional[List[str]] = ['GET']
class hawat.blueprints.networks.UpdateView[source]

Bases: hawat.view.mixin.HTMLMixin, hawat.view.mixin.SQLAlchemyMixin, hawat.view.ItemUpdateView

View for updating existing network records.

authentication = True
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_title(**kwargs)[source]

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

methods: Optional[List[str]] = ['GET', 'POST']
hawat.blueprints.networks.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.