From 3aa4f08df368a141d46ceea9b8bc6919b310e03c Mon Sep 17 00:00:00 2001
From: Jan Mach <jan.mach@cesnet.cz>
Date: Wed, 26 Feb 2020 11:51:30 +0100
Subject: [PATCH] Refactoring: Renamed Hawat constants to shorter names.

The name 'HAWAT' was omitted wherever possible to make names shorter.
---
 lib/hawat/acl.py                          |   8 +-
 lib/hawat/app.py                          |   4 +-
 lib/hawat/base.py                         |  56 +++++-----
 lib/hawat/blueprints/auth_dev/__init__.py |  20 ++--
 lib/hawat/blueprints/auth_env/__init__.py |  22 ++--
 lib/hawat/blueprints/auth_pwd/__init__.py |  10 +-
 lib/hawat/blueprints/changelogs/forms.py  |   4 +-
 lib/hawat/blueprints/dbstatus/__init__.py |  12 +--
 lib/hawat/blueprints/dnsr/__init__.py     |   8 +-
 lib/hawat/blueprints/events/__init__.py   |  32 +++---
 lib/hawat/blueprints/events/forms.py      |   2 +-
 lib/hawat/blueprints/filters/__init__.py  |   2 +-
 lib/hawat/blueprints/geoip/__init__.py    |   8 +-
 lib/hawat/blueprints/groups/__init__.py   |   2 +-
 lib/hawat/blueprints/hosts/__init__.py    |   4 +-
 lib/hawat/blueprints/nerd/__init__.py     |   8 +-
 lib/hawat/blueprints/pdnsr/__init__.py    |  10 +-
 lib/hawat/blueprints/pdnsr/forms.py       |   2 +-
 lib/hawat/blueprints/reports/__init__.py  |   6 +-
 lib/hawat/blueprints/reports/forms.py     |   4 +-
 lib/hawat/blueprints/timeline/__init__.py |   2 +-
 lib/hawat/blueprints/whois/__init__.py    |   8 +-
 lib/hawat/config.py                       |   6 +-
 lib/hawat/const.py                        | 121 ++++++++++++----------
 lib/hawat/errors.py                       |   2 +-
 lib/hawat/forms.py                        |   4 +-
 26 files changed, 191 insertions(+), 176 deletions(-)

diff --git a/lib/hawat/acl.py b/lib/hawat/acl.py
index 83c6217fa..11cfea977 100644
--- a/lib/hawat/acl.py
+++ b/lib/hawat/acl.py
@@ -31,11 +31,11 @@ ManagementNeed = partial(flask_principal.Need, 'management')   # pylint: disable
 ManagementNeed.__doc__ = """A need with the method preset to `"management"`."""
 
 
-ROLE_NAME_ADMIN      = hawat.const.HAWAT_ROLE_ADMIN
-ROLE_NAME_MAINTAINER = hawat.const.HAWAT_ROLE_MAINTAINER
+ROLE_NAME_ADMIN      = hawat.const.ROLE_ADMIN
+ROLE_NAME_MAINTAINER = hawat.const.ROLE_MAINTAINER
 ROLE_NAME_POWER      = 'power'
-ROLE_NAME_DEVELOPER  = hawat.const.HAWAT_ROLE_DEVELOPER
-ROLE_NAME_USER       = hawat.const.HAWAT_ROLE_USER
+ROLE_NAME_DEVELOPER  = hawat.const.ROLE_DEVELOPER
+ROLE_NAME_USER       = hawat.const.ROLE_USER
 ROLE_NAME_ANY        = 'any'
 
 
diff --git a/lib/hawat/app.py b/lib/hawat/app.py
index 1d1152492..4b60d9e85 100644
--- a/lib/hawat/app.py
+++ b/lib/hawat/app.py
@@ -677,7 +677,7 @@ def _setup_app_auth(app):
         flask_login.logout_user()
         flask.flash(
             flask_babel.gettext('You have been successfully logged out.'),
-            hawat.const.HAWAT_FLASH_SUCCESS
+            hawat.const.FLASH_SUCCESS
         )
 
         # Remove session keys set by Flask-Principal.
@@ -847,7 +847,7 @@ def _setup_app_intl(app):
                 lclc = code,
                 lcln = flask.current_app.config['SUPPORTED_LOCALES'][code]
             )),
-            hawat.const.HAWAT_FLASH_SUCCESS
+            hawat.const.FLASH_SUCCESS
         )
 
         # Redirect user back to original page.
diff --git a/lib/hawat/base.py b/lib/hawat/base.py
index 37ce54078..0c43c2794 100644
--- a/lib/hawat/base.py
+++ b/lib/hawat/base.py
@@ -1597,7 +1597,7 @@ class BaseSearchView(RenderableView, HawatUtils):
         form = self.get_search_form(flask.request.args)
         flask.g.search_form = form
 
-        if hawat.const.HAWAT_FORM_ACTION_SUBMIT in flask.request.args:
+        if hawat.const.FORM_ACTION_SUBMIT in flask.request.args:
             if form.validate():
                 form_data = form.data
 
@@ -1669,7 +1669,7 @@ class BaseSearchView(RenderableView, HawatUtils):
                                     address = flask.escape(str(match.group(1)))
                                 )
                             ),
-                            hawat.const.HAWAT_FLASH_FAILURE
+                            hawat.const.FLASH_FAILURE
                         )
                     else:
                         raise
@@ -1931,10 +1931,10 @@ class ItemActionView(RenderableView):  # pylint: disable=locally-disabled,abstra
         """
         Check the form for *cancel* button press and cancel the action.
         """
-        if getattr(form, hawat.const.HAWAT_FORM_ACTION_CANCEL).data:
+        if getattr(form, hawat.const.FORM_ACTION_CANCEL).data:
             self.flash(
                 flask.Markup(self.get_message_cancel(**kwargs)),
-                hawat.const.HAWAT_FLASH_INFO
+                hawat.const.FLASH_INFO
             )
             return self.redirect(default_url = self.get_url_next())
 
@@ -2083,7 +2083,7 @@ class ItemCreateView(ItemActionView):  # pylint: disable=locally-disabled,abstra
 
             self.do_before_action(item)
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_SUBMIT]:
+            if form_data[hawat.const.FORM_ACTION_SUBMIT]:
                 try:
                     self.dbsession.add(item)
                     self.dbsession.commit()
@@ -2094,7 +2094,7 @@ class ItemCreateView(ItemActionView):  # pylint: disable=locally-disabled,abstra
 
                     self.flash(
                         flask.Markup(self.get_message_success(item = item)),
-                        hawat.const.HAWAT_FLASH_SUCCESS
+                        hawat.const.FLASH_SUCCESS
                     )
                     return self.redirect(default_url = self.get_url_next())
 
@@ -2102,7 +2102,7 @@ class ItemCreateView(ItemActionView):  # pylint: disable=locally-disabled,abstra
                     self.dbsession.rollback()
                     self.flash(
                         flask.Markup(self.get_message_failure()),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
                     flask.current_app.log_exception_with_label(
                         traceback.TracebackException(*sys.exc_info()),
@@ -2114,7 +2114,7 @@ class ItemCreateView(ItemActionView):  # pylint: disable=locally-disabled,abstra
             action_name = gettext('Create'),
             form_url    = flask.url_for('{}.{}'.format(self.module_name, self.get_view_name())),
             form        = form,
-            item_action = hawat.const.HAWAT_ITEM_ACTION_CREATE,
+            item_action = hawat.const.ACTION_ITEM_CREATE,
             item        = item
         )
 
@@ -2225,7 +2225,7 @@ class HawatItemCreateForView(ItemActionView):  # pylint: disable=locally-disable
             self.do_before_action(item)
             self.add_parent_to_item(item, parent)
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_SUBMIT]:
+            if form_data[hawat.const.FORM_ACTION_SUBMIT]:
                 try:
                     self.dbsession.add(item)
                     self.dbsession.commit()
@@ -2236,7 +2236,7 @@ class HawatItemCreateForView(ItemActionView):  # pylint: disable=locally-disable
 
                     self.flash(
                         flask.Markup(self.get_message_success(item = item, parent = parent)),
-                        hawat.const.HAWAT_FLASH_SUCCESS
+                        hawat.const.FLASH_SUCCESS
                     )
                     return self.redirect(default_url = self.get_url_next())
 
@@ -2244,7 +2244,7 @@ class HawatItemCreateForView(ItemActionView):  # pylint: disable=locally-disable
                     self.dbsession.rollback()
                     self.flash(
                         flask.Markup(self.get_message_failure(parent = parent)),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
                     flask.current_app.log_exception_with_label(
                         traceback.TracebackException(*sys.exc_info()),
@@ -2256,7 +2256,7 @@ class HawatItemCreateForView(ItemActionView):  # pylint: disable=locally-disable
             action_name = gettext('Create'),
             form_url    = flask.url_for('{}.{}'.format(self.module_name, self.get_view_name()), parent_id = parent_id),
             form        = form,
-            item_action = hawat.const.HAWAT_ITEM_ACTION_CREATEFOR,
+            item_action = hawat.const.ACTION_ITEM_CREATEFOR,
             item        = item
         )
 
@@ -2340,12 +2340,12 @@ class ItemUpdateView(ItemActionView):  # pylint: disable=locally-disabled,abstra
 
             self.do_before_action(item)
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_SUBMIT]:
+            if form_data[hawat.const.FORM_ACTION_SUBMIT]:
                 try:
                     if item not in self.dbsession.dirty:
                         self.flash(
                             gettext('No changes detected, no update needed.'),
-                            hawat.const.HAWAT_FLASH_INFO
+                            hawat.const.FLASH_INFO
                         )
                         return self.redirect(default_url = self.get_url_next())
 
@@ -2357,7 +2357,7 @@ class ItemUpdateView(ItemActionView):  # pylint: disable=locally-disabled,abstra
 
                     self.flash(
                         flask.Markup(self.get_message_success(item = item)),
-                        hawat.const.HAWAT_FLASH_SUCCESS
+                        hawat.const.FLASH_SUCCESS
                     )
                     return self.redirect(default_url = self.get_url_next())
 
@@ -2365,7 +2365,7 @@ class ItemUpdateView(ItemActionView):  # pylint: disable=locally-disabled,abstra
                     self.dbsession.rollback()
                     self.flash(
                         flask.Markup(self.get_message_failure(item = item)),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
                     flask.current_app.log_exception_with_label(
                         traceback.TracebackException(*sys.exc_info()),
@@ -2377,7 +2377,7 @@ class ItemUpdateView(ItemActionView):  # pylint: disable=locally-disabled,abstra
             action_name = gettext('Update'),
             form_url    = flask.url_for('{}.{}'.format(self.module_name, self.get_view_name()), item_id = item_id),
             form        = form,
-            item_action = hawat.const.HAWAT_ITEM_ACTION_UPDATE,
+            item_action = hawat.const.ACTION_ITEM_UPDATE,
             item_id     = item_id,
             item        = item
         )
@@ -2436,7 +2436,7 @@ class ItemDeleteView(ItemActionView):  # pylint: disable=locally-disabled,abstra
 
             self.do_before_action(item)
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_SUBMIT]:
+            if form_data[hawat.const.FORM_ACTION_SUBMIT]:
                 try:
                     self.dbsession.delete(item)
                     self.dbsession.commit()
@@ -2447,7 +2447,7 @@ class ItemDeleteView(ItemActionView):  # pylint: disable=locally-disabled,abstra
 
                     self.flash(
                         flask.Markup(self.get_message_success(item = item)),
-                        hawat.const.HAWAT_FLASH_SUCCESS
+                        hawat.const.FLASH_SUCCESS
                     )
                     return self.redirect(
                         default_url = self.get_url_next(),
@@ -2458,7 +2458,7 @@ class ItemDeleteView(ItemActionView):  # pylint: disable=locally-disabled,abstra
                     self.dbsession.rollback()
                     self.flash(
                         flask.Markup(self.get_message_failure(item = item)),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
                     flask.current_app.log_exception_with_label(
                         traceback.TracebackException(*sys.exc_info()),
@@ -2532,13 +2532,13 @@ class ItemChangeView(ItemActionView):  # pylint: disable=locally-disabled,abstra
 
             self.do_before_action(item)
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_SUBMIT]:
+            if form_data[hawat.const.FORM_ACTION_SUBMIT]:
                 try:
                     self.change_item(item = item)
                     if item not in self.dbsession.dirty:
                         self.flash(
                             gettext('No changes detected, no update needed.'),
-                            hawat.const.HAWAT_FLASH_INFO
+                            hawat.const.FLASH_INFO
                         )
                         return self.redirect(default_url = self.get_url_next())
 
@@ -2550,7 +2550,7 @@ class ItemChangeView(ItemActionView):  # pylint: disable=locally-disabled,abstra
 
                     self.flash(
                         flask.Markup(self.get_message_success(item = item)),
-                        hawat.const.HAWAT_FLASH_SUCCESS
+                        hawat.const.FLASH_SUCCESS
                     )
                     try:
                         exclude_url = flask.url_for('{}.{}'.format(self.module_name, 'show'), item_id = item.id)
@@ -2565,7 +2565,7 @@ class ItemChangeView(ItemActionView):  # pylint: disable=locally-disabled,abstra
                     self.dbsession.rollback()
                     self.flash(
                         flask.Markup(self.get_message_failure(item = item)),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
                     flask.current_app.log_exception_with_label(
                         traceback.TracebackException(*sys.exc_info()),
@@ -2746,13 +2746,13 @@ class ItemObjectRelationView(ItemChangeView):  # pylint: disable=locally-disable
 
             self.do_before_action(item)
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_SUBMIT]:
+            if form_data[hawat.const.FORM_ACTION_SUBMIT]:
                 try:
                     self.change_item(item = item, other = other)
                     if item not in self.dbsession.dirty:
                         self.flash(
                             gettext('No changes detected, no update needed.'),
-                            hawat.const.HAWAT_FLASH_INFO
+                            hawat.const.FLASH_INFO
                         )
                         return self.redirect(default_url = self.get_url_next())
 
@@ -2769,7 +2769,7 @@ class ItemObjectRelationView(ItemChangeView):  # pylint: disable=locally-disable
                                 other = other
                             )
                         ),
-                        hawat.const.HAWAT_FLASH_SUCCESS
+                        hawat.const.FLASH_SUCCESS
                     )
                     try:
                         exclude_url = flask.url_for(
@@ -2789,7 +2789,7 @@ class ItemObjectRelationView(ItemChangeView):  # pylint: disable=locally-disable
                         flask.Markup(
                             self.get_message_failure(item = item, other = other)
                         ),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
                     flask.current_app.log_exception_with_label(
                         traceback.TracebackException(*sys.exc_info()),
diff --git a/lib/hawat/blueprints/auth_dev/__init__.py b/lib/hawat/blueprints/auth_dev/__init__.py
index 2910bef6a..57aa7075d 100644
--- a/lib/hawat/blueprints/auth_dev/__init__.py
+++ b/lib/hawat/blueprints/auth_dev/__init__.py
@@ -117,7 +117,7 @@ class LoginView(HTMLMixin, SQLAlchemyMixin, SimpleView):
                             login = user.login,
                             name = user.fullname
                         )),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
 
                 flask_login.login_user(user)
@@ -135,7 +135,7 @@ class LoginView(HTMLMixin, SQLAlchemyMixin, SimpleView):
                         'You have been successfully logged in as <strong>%(user)s</strong>.',
                         user = str(user)
                     )),
-                    hawat.const.HAWAT_FLASH_SUCCESS
+                    hawat.const.FLASH_SUCCESS
                 )
                 self.logger.info(
                     "User '{}' successfully logged in with 'auth_dev'.".format(
@@ -161,7 +161,7 @@ class LoginView(HTMLMixin, SQLAlchemyMixin, SimpleView):
             except sqlalchemy.orm.exc.NoResultFound:
                 self.flash(
                     gettext('You have entered wrong login credentials.'),
-                    hawat.const.HAWAT_FLASH_FAILURE
+                    hawat.const.FLASH_FAILURE
                 )
 
             except Exception:  # pylint: disable=locally-disabled,broad-except
@@ -170,7 +170,7 @@ class LoginView(HTMLMixin, SQLAlchemyMixin, SimpleView):
                         "Unable to perform developer login as <strong>%(user)s</strong>.",
                         user = str(form.login.data)
                     )),
-                    hawat.const.HAWAT_FLASH_FAILURE
+                    hawat.const.FLASH_FAILURE
                 )
                 flask.current_app.log_exception_with_label(
                     traceback.TracebackException(*sys.exc_info()),
@@ -353,10 +353,10 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView):
         if form.validate_on_submit():
             form_data = form.data
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_CANCEL]:
+            if form_data[hawat.const.FORM_ACTION_CANCEL]:
                 self.flash(
                     gettext('Account registration canceled.'),
-                    hawat.const.HAWAT_FLASH_INFO
+                    hawat.const.FLASH_INFO
                 )
                 return self.redirect(
                     default_url = flask.url_for(
@@ -364,13 +364,13 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView):
                     )
                 )
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_SUBMIT]:
+            if form_data[hawat.const.FORM_ACTION_SUBMIT]:
                 try:
                     # Populate the user object from form data and make sure the
                     # account has default 'user' role and is disabled by default.
                     item = self.dbmodel()
                     form.populate_obj(item)
-                    item.roles = [hawat.const.HAWAT_ROLE_USER]
+                    item.roles = [hawat.const.ROLE_USER]
                     item.enabled = False
 
                     self.dbsession.add(item)
@@ -389,7 +389,7 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView):
                             login = item.login,
                             name = item.fullname
                         )),
-                        hawat.const.HAWAT_FLASH_SUCCESS
+                        hawat.const.FLASH_SUCCESS
                     )
                     return self.redirect(
                         default_url = flask.url_for(
@@ -400,7 +400,7 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView):
                 except Exception:  # pylint: disable=locally-disabled,broad-except
                     self.flash(
                         gettext('Unable to register new user account.'),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
                     flask.current_app.log_exception_with_label(
                         traceback.TracebackException(*sys.exc_info()),
diff --git a/lib/hawat/blueprints/auth_env/__init__.py b/lib/hawat/blueprints/auth_env/__init__.py
index 6ba2a27db..801678e81 100644
--- a/lib/hawat/blueprints/auth_env/__init__.py
+++ b/lib/hawat/blueprints/auth_env/__init__.py
@@ -163,7 +163,7 @@ class LoginView(HTMLMixin, RenderableView):
         if not user_login:
             self.flash(
                 gettext('User login was not received, unable to perform login process.'),
-                hawat.const.HAWAT_FLASH_FAILURE
+                hawat.const.FLASH_FAILURE
             )
             self.abort(403)
 
@@ -182,7 +182,7 @@ class LoginView(HTMLMixin, RenderableView):
         except sqlalchemy.orm.exc.NoResultFound:
             self.flash(
                 gettext('You have entered wrong login credentials.'),
-                hawat.const.HAWAT_FLASH_FAILURE
+                hawat.const.FLASH_FAILURE
             )
             self.abort(403)
 
@@ -193,7 +193,7 @@ class LoginView(HTMLMixin, RenderableView):
                     login = user.login,
                     name = user.fullname
                 )),
-                hawat.const.HAWAT_FLASH_FAILURE
+                hawat.const.FLASH_FAILURE
             )
             self.abort(403)
 
@@ -217,7 +217,7 @@ class LoginView(HTMLMixin, RenderableView):
                 login = user.login,
                 name = user.fullname
             )),
-            hawat.const.HAWAT_FLASH_SUCCESS
+            hawat.const.FLASH_SUCCESS
         )
         self.logger.info(
             "User '{}' successfully logged in with 'auth_env'.".format(
@@ -463,7 +463,7 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView):
                     'User account <strong>%(item_id)s</strong> already exists.',
                     item_id = str(user)
                 )),
-                hawat.const.HAWAT_FLASH_FAILURE
+                hawat.const.FLASH_FAILURE
             )
             self.response_context.update(item = user)
             return self.generate_response(
@@ -475,10 +475,10 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView):
         if form.validate_on_submit():
             form_data = form.data
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_CANCEL]:
+            if form_data[hawat.const.FORM_ACTION_CANCEL]:
                 self.flash(
                     gettext('Account registration canceled.'),
-                    hawat.const.HAWAT_FLASH_INFO
+                    hawat.const.FLASH_INFO
                 )
                 return self.redirect(
                     default_url = flask.url_for(
@@ -486,12 +486,12 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView):
                     )
                 )
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_SUBMIT]:
+            if form_data[hawat.const.FORM_ACTION_SUBMIT]:
                 try:
                     # Populate the user object from form data and make sure the
                     # account has default 'user' role and is disabled by default.
                     form.populate_obj(item)
-                    item.roles = [hawat.const.HAWAT_ROLE_USER]
+                    item.roles = [hawat.const.ROLE_USER]
                     item.enabled = False
 
                     self.dbsession.add(item)
@@ -510,7 +510,7 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView):
                             login = item.login,
                             name = item.fullname
                         )),
-                        hawat.const.HAWAT_FLASH_SUCCESS
+                        hawat.const.FLASH_SUCCESS
                     )
                     return self.generate_response(
                         view_template = 'auth_env/registration_show.html'
@@ -519,7 +519,7 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView):
                 except Exception:  # pylint: disable=locally-disabled,broad-except
                     self.flash(
                         gettext('Unable to register new user account.'),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
                     flask.current_app.log_exception_with_label(
                         traceback.TracebackException(*sys.exc_info()),
diff --git a/lib/hawat/blueprints/auth_pwd/__init__.py b/lib/hawat/blueprints/auth_pwd/__init__.py
index 96de038c6..986a22de4 100644
--- a/lib/hawat/blueprints/auth_pwd/__init__.py
+++ b/lib/hawat/blueprints/auth_pwd/__init__.py
@@ -124,7 +124,7 @@ class LoginView(HTMLMixin, SQLAlchemyMixin, SimpleView):
                                 login = user.login,
                                 name = user.fullname
                             )),
-                            hawat.const.HAWAT_FLASH_FAILURE
+                            hawat.const.FLASH_FAILURE
                         )
                         self.abort(403)
 
@@ -148,7 +148,7 @@ class LoginView(HTMLMixin, SQLAlchemyMixin, SimpleView):
                             login = user.login,
                             name = user.fullname
                         )),
-                        hawat.const.HAWAT_FLASH_SUCCESS
+                        hawat.const.FLASH_SUCCESS
                     )
                     self.logger.info(
                         "User '{}' successfully logged in with 'auth_pwd'.".format(
@@ -167,7 +167,7 @@ class LoginView(HTMLMixin, SQLAlchemyMixin, SimpleView):
                 # not say specifically it was password, that was invalid.
                 self.flash(
                     gettext('You have entered wrong login credentials.'),
-                    hawat.const.HAWAT_FLASH_FAILURE
+                    hawat.const.FLASH_FAILURE
                 )
 
             except sqlalchemy.orm.exc.MultipleResultsFound:
@@ -181,7 +181,7 @@ class LoginView(HTMLMixin, SQLAlchemyMixin, SimpleView):
             except sqlalchemy.orm.exc.NoResultFound:
                 self.flash(
                     gettext('You have entered wrong login credentials.'),
-                    hawat.const.HAWAT_FLASH_FAILURE
+                    hawat.const.FLASH_FAILURE
                 )
 
             except Exception:  # pylint: disable=locally-disabled,broad-except
@@ -190,7 +190,7 @@ class LoginView(HTMLMixin, SQLAlchemyMixin, SimpleView):
                         "Unable to perform password login as <strong>%(user)s</strong>.",
                         user = str(form.login.data)
                     )),
-                    hawat.const.HAWAT_FLASH_FAILURE
+                    hawat.const.FLASH_FAILURE
                 )
                 flask.current_app.log_exception_with_label(
                     traceback.TracebackException(*sys.exc_info()),
diff --git a/lib/hawat/blueprints/changelogs/forms.py b/lib/hawat/blueprints/changelogs/forms.py
index a28bcc95d..6ad83b4ec 100644
--- a/lib/hawat/blueprints/changelogs/forms.py
+++ b/lib/hawat/blueprints/changelogs/forms.py
@@ -101,7 +101,7 @@ class ItemChangeLogSearchForm(hawat.forms.BaseSearchForm):
         validators = [
             wtforms.validators.Optional()
         ],
-        default = lambda: hawat.forms.default_dt_with_delta(hawat.const.HAWAT_DEFAULT_RESULT_TIMEDELTA)
+        default = lambda: hawat.forms.default_dt_with_delta(hawat.const.DEFAULT_RESULT_TIMEDELTA)
     )
     dt_to = hawat.forms.SmartDateTimeField(
         lazy_gettext('To:'),
@@ -139,7 +139,7 @@ class ItemChangeLogDashboardForm(flask_wtf.FlaskForm):
         validators = [
             wtforms.validators.Optional()
         ],
-        default = lambda: hawat.forms.default_dt_with_delta(hawat.const.HAWAT_DEFAULT_RESULT_TIMEDELTA)
+        default = lambda: hawat.forms.default_dt_with_delta(hawat.const.DEFAULT_RESULT_TIMEDELTA)
     )
     dt_to = hawat.forms.SmartDateTimeField(
         lazy_gettext('To:'),
diff --git a/lib/hawat/blueprints/dbstatus/__init__.py b/lib/hawat/blueprints/dbstatus/__init__.py
index 24a83fb23..2a6d6e35c 100644
--- a/lib/hawat/blueprints/dbstatus/__init__.py
+++ b/lib/hawat/blueprints/dbstatus/__init__.py
@@ -373,10 +373,10 @@ class AbstractQueryStopView(PsycopgMixin, RenderableView):
         """
         Check the form for *cancel* button press and cancel the action.
         """
-        if getattr(form, hawat.const.HAWAT_FORM_ACTION_CANCEL).data:
+        if getattr(form, hawat.const.FORM_ACTION_CANCEL).data:
             self.flash(
                 flask.Markup(self.get_message_cancel(**kwargs)),
-                hawat.const.HAWAT_FLASH_INFO
+                hawat.const.FLASH_INFO
             )
             return self.redirect(default_url = self.get_url_next())
 
@@ -403,18 +403,18 @@ class AbstractQueryStopView(PsycopgMixin, RenderableView):
         if form.validate_on_submit():
             form_data = form.data
 
-            if form_data[hawat.const.HAWAT_FORM_ACTION_SUBMIT]:
+            if form_data[hawat.const.FORM_ACTION_SUBMIT]:
                 try:
                     action_status = self.get_db().query_cancel(item_id)
                     if action_status:
                         self.flash(
                             flask.Markup(self.get_message_success(item = item)),
-                            hawat.const.HAWAT_FLASH_SUCCESS
+                            hawat.const.FLASH_SUCCESS
                         )
                     else:
                         self.flash(
                             flask.Markup(self.get_message_failure(item = item)),
-                            hawat.const.HAWAT_FLASH_FAILURE
+                            hawat.const.FLASH_FAILURE
                         )
                     self.get_db().commit()
                     return self.redirect(default_url = self.get_url_next())
@@ -423,7 +423,7 @@ class AbstractQueryStopView(PsycopgMixin, RenderableView):
                     self.get_db().commit()
                     self.flash(
                         flask.Markup(self.get_message_failure(item = item)),
-                        hawat.const.HAWAT_FLASH_FAILURE
+                        hawat.const.FLASH_FAILURE
                     )
                     flask.current_app.log_exception_with_label(
                         traceback.TracebackException(*sys.exc_info()),
diff --git a/lib/hawat/blueprints/dnsr/__init__.py b/lib/hawat/blueprints/dnsr/__init__.py
index becca75ba..530bec531 100644
--- a/lib/hawat/blueprints/dnsr/__init__.py
+++ b/lib/hawat/blueprints/dnsr/__init__.py
@@ -100,7 +100,7 @@ class AbstractSearchView(RenderableView):  # pylint: disable=locally-disabled,ab
         """
         form = DnsrSearchForm(flask.request.args, meta = {'csrf': False})
 
-        if hawat.const.HAWAT_FORM_ACTION_SUBMIT in flask.request.args:
+        if hawat.const.FORM_ACTION_SUBMIT in flask.request.args:
             if form.validate():
                 form_data = form.data
                 dnsr_service = mentat.services.dnsr.service()
@@ -210,7 +210,7 @@ class DnsrBlueprint(HawatBlueprint):
 
         # Register context actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for address <strong>%(name)s</strong> in DNS service'),
             SearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search')
@@ -218,12 +218,12 @@ class DnsrBlueprint(HawatBlueprint):
 
         # Register object additional data services provided by this module.
         app.set_oads(
-            hawat.const.HAWAT_AODS_IP4,
+            hawat.const.AODS_IP4,
             SnippetSearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search').add_kwrule('render', False, True)
         )
         app.set_oads(
-            hawat.const.HAWAT_AODS_IP6,
+            hawat.const.AODS_IP6,
             SnippetSearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search').add_kwrule('render', False, True)
         )
diff --git a/lib/hawat/blueprints/events/__init__.py b/lib/hawat/blueprints/events/__init__.py
index e30495830..fc6338abd 100644
--- a/lib/hawat/blueprints/events/__init__.py
+++ b/lib/hawat/blueprints/events/__init__.py
@@ -513,106 +513,106 @@ class EventsBlueprint(HawatBlueprint):
 
         # Register context search actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ABUSE,
+            hawat.const.CSAG_ABUSE,
             tr_('Search for abuse group <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('groups', True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for source <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('source_addrs', True).add_kwrule('groups', True, True)
         )
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for target <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('target_addrs', True).add_kwrule('groups', True, True)
         )
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for host <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('host_addrs', True).add_kwrule('groups', True, True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_CATEGORY,
+            hawat.const.CSAG_CATEGORY,
             tr_('Search for category <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('categories', True).add_kwrule('groups', True, True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_CLASS,
+            hawat.const.CSAG_CLASS,
             tr_('Search for class <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('classes', True).add_kwrule('groups', True, True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_DETECTOR,
+            hawat.const.CSAG_DETECTOR,
             tr_('Search for detector <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('detectors', True).add_kwrule('groups', True, True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_DETTYPE,
+            hawat.const.CSAG_DETTYPE,
             tr_('Search for detector type <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('detector_types', True).add_kwrule('groups', True, True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_HOSTTYPE,
+            hawat.const.CSAG_HOSTTYPE,
             tr_('Search for source type <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('source_types', True).add_kwrule('groups', True, True)
         )
         app.set_csag(
-            hawat.const.HAWAT_CSAG_HOSTTYPE,
+            hawat.const.CSAG_HOSTTYPE,
             tr_('Search for target type <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('target_types', True).add_kwrule('groups', True, True)
         )
         app.set_csag(
-            hawat.const.HAWAT_CSAG_HOSTTYPE,
+            hawat.const.CSAG_HOSTTYPE,
             tr_('Search for host type <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('host_types', True).add_kwrule('groups', True, True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_PORT,
+            hawat.const.CSAG_PORT,
             tr_('Search for source port <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('source_ports', True).add_kwrule('groups', True, True)
         )
         app.set_csag(
-            hawat.const.HAWAT_CSAG_PORT,
+            hawat.const.CSAG_PORT,
             tr_('Search for target port <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('target_ports', True).add_kwrule('groups', True, True)
         )
         app.set_csag(
-            hawat.const.HAWAT_CSAG_PORT,
+            hawat.const.CSAG_PORT,
             tr_('Search for host port <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('host_ports', True).add_kwrule('groups', True, True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_PROTOCOL,
+            hawat.const.CSAG_PROTOCOL,
             tr_('Search for protocol <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('protocols', True).add_kwrule('groups', True, True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_SEVERITY,
+            hawat.const.CSAG_SEVERITY,
             tr_('Search for severity <strong>%(name)s</strong> in event database'),
             SearchView,
             _get_upb().add_rule('severities', True).add_kwrule('groups', True, True)
diff --git a/lib/hawat/blueprints/events/forms.py b/lib/hawat/blueprints/events/forms.py
index bbd3dacaa..192861772 100644
--- a/lib/hawat/blueprints/events/forms.py
+++ b/lib/hawat/blueprints/events/forms.py
@@ -348,7 +348,7 @@ class EventDashboardForm(flask_wtf.FlaskForm):
         validators = [
             wtforms.validators.Optional()
         ],
-        default = lambda: hawat.forms.default_dt_with_delta(hawat.const.HAWAT_DEFAULT_RESULT_TIMEDELTA),
+        default = lambda: hawat.forms.default_dt_with_delta(hawat.const.DEFAULT_RESULT_TIMEDELTA),
         description = lazy_gettext('Lower time boundary for event detection time as provided by event detector. Timestamp is expected to be in the format <code>YYYY-MM-DD hh:mm:ss</code> and in the timezone according to the user`s preferences. Event detectors are usually outside of the control of Mentat system administrators and may sometimes emit events with invalid detection times, for example timestamps in the future.')
     )
     dt_to = hawat.forms.SmartDateTimeField(
diff --git a/lib/hawat/blueprints/filters/__init__.py b/lib/hawat/blueprints/filters/__init__.py
index f22cda616..b4489763a 100644
--- a/lib/hawat/blueprints/filters/__init__.py
+++ b/lib/hawat/blueprints/filters/__init__.py
@@ -826,7 +826,7 @@ class PlaygroundView(HTMLMixin, RenderableView):
                         '<strong>%(error)s</strong>.',
                         error = str(err)
                     )),
-                    hawat.const.HAWAT_FLASH_FAILURE
+                    hawat.const.FLASH_FAILURE
                 )
 
                 tbexc = traceback.TracebackException(*sys.exc_info())
diff --git a/lib/hawat/blueprints/geoip/__init__.py b/lib/hawat/blueprints/geoip/__init__.py
index 0927bcb78..540ce40d7 100644
--- a/lib/hawat/blueprints/geoip/__init__.py
+++ b/lib/hawat/blueprints/geoip/__init__.py
@@ -103,7 +103,7 @@ class AbstractSearchView(RenderableView):  # pylint: disable=locally-disabled,ab
         Will be called by the *Flask* framework to service the request.
         """
         form = GeoipSearchForm(flask.request.args, meta = {'csrf': False})
-        if hawat.const.HAWAT_FORM_ACTION_SUBMIT in flask.request.args:
+        if hawat.const.FORM_ACTION_SUBMIT in flask.request.args:
             if form.validate():
                 form_data = form.data
                 geoip_service = mentat.services.geoip.service()
@@ -215,7 +215,7 @@ class GeoipBlueprint(HawatBlueprint):
 
         # Register context actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for address <strong>%(name)s</strong> in IP geolocation service'),
             SearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search')
@@ -223,12 +223,12 @@ class GeoipBlueprint(HawatBlueprint):
 
         # Register object additional data services provided by this module.
         app.set_oads(
-            hawat.const.HAWAT_AODS_IP4,
+            hawat.const.AODS_IP4,
             SnippetSearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search').add_kwrule('render', False, True)
         )
         app.set_oads(
-            hawat.const.HAWAT_AODS_IP6,
+            hawat.const.AODS_IP6,
             SnippetSearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search').add_kwrule('render', False, True)
         )
diff --git a/lib/hawat/blueprints/groups/__init__.py b/lib/hawat/blueprints/groups/__init__.py
index f56fbec4e..e9f82048b 100644
--- a/lib/hawat/blueprints/groups/__init__.py
+++ b/lib/hawat/blueprints/groups/__init__.py
@@ -972,7 +972,7 @@ class GroupsBlueprint(HawatBlueprint):
 
         # Register context actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ABUSE,
+            hawat.const.CSAG_ABUSE,
             tr_('View details of abuse group <strong>%(name)s</strong>'),
             ShowByNameView,
             URLParamsBuilder().add_rule('item_id')
diff --git a/lib/hawat/blueprints/hosts/__init__.py b/lib/hawat/blueprints/hosts/__init__.py
index 5b73d6a7c..e7ccf03b8 100644
--- a/lib/hawat/blueprints/hosts/__init__.py
+++ b/lib/hawat/blueprints/hosts/__init__.py
@@ -10,7 +10,7 @@
 
 """
 This file contains pluggable module for Hawat web interface containing features
-related to real time dashboard calculations for `IDEA <https://idea.cesnet.cz/en/index>`__ 
+related to real time dashboard calculations for `IDEA <https://idea.cesnet.cz/en/index>`__
 events. This module is currently experimental, because the searching and statistical
 calculations can be very performance demanding.
 """
@@ -201,7 +201,7 @@ class HostsBlueprint(HawatBlueprint):
 
         # Register context actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for source <strong>%(name)s</strong> in host overview'),
             SearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('host_addr').add_kwrule('dt_from', False, True).add_kwrule('dt_to', False, True)
diff --git a/lib/hawat/blueprints/nerd/__init__.py b/lib/hawat/blueprints/nerd/__init__.py
index 009613e2c..440e83849 100644
--- a/lib/hawat/blueprints/nerd/__init__.py
+++ b/lib/hawat/blueprints/nerd/__init__.py
@@ -101,7 +101,7 @@ class AbstractSearchView(RenderableView):  # pylint: disable=locally-disabled,ab
         """
         form = NerdSearchForm(flask.request.args, meta = {'csrf': False})
 
-        if hawat.const.HAWAT_FORM_ACTION_SUBMIT in flask.request.args:
+        if hawat.const.FORM_ACTION_SUBMIT in flask.request.args:
             if form.validate():
                 form_data = form.data
                 nerd_service = mentat.services.nerd.service()
@@ -209,13 +209,13 @@ class NerdBlueprint(HawatBlueprint):
 
         # Register context actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for address <strong>%(name)s</strong> locally in NERD service'),
             SearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search')
         )
         app.set_csag_url(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for address <strong>%(name)s</strong> externally in NERD service'),
             SearchView.get_view_icon(),
             mentat.services.nerd.service().get_url_lookup_ip
@@ -223,7 +223,7 @@ class NerdBlueprint(HawatBlueprint):
 
         # Register object additional data services provided by this module.
         app.set_oads(
-            hawat.const.HAWAT_AODS_IP4,
+            hawat.const.AODS_IP4,
             SnippetSearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search').add_kwrule('render', False, True)
         )
diff --git a/lib/hawat/blueprints/pdnsr/__init__.py b/lib/hawat/blueprints/pdnsr/__init__.py
index 730a3e807..19cec616a 100644
--- a/lib/hawat/blueprints/pdnsr/__init__.py
+++ b/lib/hawat/blueprints/pdnsr/__init__.py
@@ -101,7 +101,7 @@ class AbstractSearchView(RenderableView):  # pylint: disable=locally-disabled,ab
         """
         form = PDNSRSearchForm(flask.request.args, meta = {'csrf': False})
 
-        if hawat.const.HAWAT_FORM_ACTION_SUBMIT in flask.request.args:
+        if hawat.const.FORM_ACTION_SUBMIT in flask.request.args:
             if form.validate():
                 form_data = form.data
                 pdnsr_service = mentat.services.pdnsr.service()
@@ -214,13 +214,13 @@ class PDNSRBlueprint(HawatBlueprint):
 
         # Register context actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for address <strong>%(name)s</strong> locally in PassiveDNS service'),
             SearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search')
         )
         app.set_csag_url(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for address <strong>%(name)s</strong> externally in PassiveDNS service'),
             SearchView.get_view_icon(),
             mentat.services.pdnsr.service().get_url_lookup_ip
@@ -228,12 +228,12 @@ class PDNSRBlueprint(HawatBlueprint):
 
         # Register object additional data services provided by this module.
         app.set_oads(
-            hawat.const.HAWAT_AODS_IP4,
+            hawat.const.AODS_IP4,
             SnippetSearchView,
             URLParamsBuilder({'submit': tr_('Search'), 'sortby': 'count.desc'}).add_rule('search').add_kwrule('render', False, True)
         )
         app.set_oads(
-            hawat.const.HAWAT_AODS_IP6,
+            hawat.const.AODS_IP6,
             SnippetSearchView,
             URLParamsBuilder({'submit': tr_('Search'), 'sortby': 'count.desc'}).add_rule('search').add_kwrule('render', False, True)
         )
diff --git a/lib/hawat/blueprints/pdnsr/forms.py b/lib/hawat/blueprints/pdnsr/forms.py
index 4ff335e89..6e72db34e 100644
--- a/lib/hawat/blueprints/pdnsr/forms.py
+++ b/lib/hawat/blueprints/pdnsr/forms.py
@@ -59,7 +59,7 @@ class PDNSRSearchForm(flask_wtf.FlaskForm):
             wtforms.validators.Optional()
         ],
         filters = [int],
-        choices = [(0, lazy_gettext('without explicit limit'))] + hawat.const.HAWAT_PAGER_LIMIT_CHOICES,
+        choices = [(0, lazy_gettext('without explicit limit'))] + hawat.const.PAGER_LIMIT_CHOICES,
         default = 0
     )
     submit = wtforms.SubmitField(
diff --git a/lib/hawat/blueprints/reports/__init__.py b/lib/hawat/blueprints/reports/__init__.py
index a4f34dc0b..b93464bbe 100644
--- a/lib/hawat/blueprints/reports/__init__.py
+++ b/lib/hawat/blueprints/reports/__init__.py
@@ -95,7 +95,7 @@ def adjust_query_for_groups(query, groups):
         return query.join(GroupModel).filter(GroupModel.id.in_([grp.id for grp in groups]))
 
     # For non-administrators restrict query only to groups they are member of.
-    if not flask_login.current_user.has_role(hawat.const.HAWAT_ROLE_ADMIN):
+    if not flask_login.current_user.has_role(hawat.const.ROLE_ADMIN):
         # Naive approach.
         #query = query.filter(model.group.has(GroupModel.members.any(UserModel.id == flask_login.current_user.id)))
         # "Joined" approach.
@@ -671,14 +671,14 @@ class ReportsBlueprint(HawatBlueprint):
 
         # Register context actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ABUSE,
+            hawat.const.CSAG_ABUSE,
             tr_('Search for abuse group <strong>%(name)s</strong> in report database'),
             SearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('groups', True).add_kwrule('dt_from', False, True).add_kwrule('dt_to', False, True)
         )
 
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ABUSE,
+            hawat.const.CSAG_ABUSE,
             tr_('Search for abuse group <strong>%(name)s</strong> in reporting dashboards'),
             DashboardView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('groups', True).add_kwrule('dt_from', False, True).add_kwrule('dt_to', False, True)
diff --git a/lib/hawat/blueprints/reports/forms.py b/lib/hawat/blueprints/reports/forms.py
index 0344de728..3a2f55050 100644
--- a/lib/hawat/blueprints/reports/forms.py
+++ b/lib/hawat/blueprints/reports/forms.py
@@ -35,7 +35,7 @@ def get_available_groups():
     Query the database for list of all available groups.
     """
     # In case current user is administrator provide list of all groups.
-    if flask_login.current_user.has_role(hawat.const.HAWAT_ROLE_ADMIN):
+    if flask_login.current_user.has_role(hawat.const.ROLE_ADMIN):
         return hawat.db.db_query(GroupModel).\
             order_by(GroupModel.name).\
             all()
@@ -143,7 +143,7 @@ class ReportingDashboardForm(flask_wtf.FlaskForm):
         validators = [
             wtforms.validators.Optional()
         ],
-        default = lambda: hawat.forms.default_dt_with_delta(hawat.const.HAWAT_DEFAULT_RESULT_TIMEDELTA)
+        default = lambda: hawat.forms.default_dt_with_delta(hawat.const.DEFAULT_RESULT_TIMEDELTA)
     )
     dt_to = hawat.forms.SmartDateTimeField(
         lazy_gettext('To:'),
diff --git a/lib/hawat/blueprints/timeline/__init__.py b/lib/hawat/blueprints/timeline/__init__.py
index e0150797e..238ac935a 100644
--- a/lib/hawat/blueprints/timeline/__init__.py
+++ b/lib/hawat/blueprints/timeline/__init__.py
@@ -225,7 +225,7 @@ class TimelineBlueprint(HawatBlueprint):
 
         # Register context actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for source <strong>%(name)s</strong> on IDEA event timeline'),
             SearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('source_addrs', True).add_kwrule('dt_from', False, True).add_kwrule('dt_to', False, True)
diff --git a/lib/hawat/blueprints/whois/__init__.py b/lib/hawat/blueprints/whois/__init__.py
index 88c2875be..29649c26f 100644
--- a/lib/hawat/blueprints/whois/__init__.py
+++ b/lib/hawat/blueprints/whois/__init__.py
@@ -107,7 +107,7 @@ class AbstractSearchView(RenderableView):  # pylint: disable=locally-disabled,ab
         """
         form = WhoisSearchForm(flask.request.args, meta = {'csrf': False})
 
-        if hawat.const.HAWAT_FORM_ACTION_SUBMIT in flask.request.args:
+        if hawat.const.FORM_ACTION_SUBMIT in flask.request.args:
             if form.validate():
                 form_data = form.data
                 whois_manager = mentat.services.whois.WhoisServiceManager(flask.current_app.mconfig)
@@ -212,7 +212,7 @@ class WhoisBlueprint(HawatBlueprint):
 
         # Register context actions provided by this module.
         app.set_csag(
-            hawat.const.HAWAT_CSAG_ADDRESS,
+            hawat.const.CSAG_ADDRESS,
             tr_('Search for address <strong>%(name)s</strong> in local WHOIS service'),
             SearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search')
@@ -220,12 +220,12 @@ class WhoisBlueprint(HawatBlueprint):
 
         # Register object additional data services provided by this module.
         app.set_oads(
-            hawat.const.HAWAT_AODS_IP4,
+            hawat.const.AODS_IP4,
             SnippetSearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search').add_kwrule('render', False, True)
         )
         app.set_oads(
-            hawat.const.HAWAT_AODS_IP6,
+            hawat.const.AODS_IP6,
             SnippetSearchView,
             URLParamsBuilder({'submit': tr_('Search')}).add_rule('search').add_kwrule('render', False, True)
         )
diff --git a/lib/hawat/config.py b/lib/hawat/config.py
index 023394f1b..d5b242b2d 100644
--- a/lib/hawat/config.py
+++ b/lib/hawat/config.py
@@ -104,8 +104,8 @@ class Config:  # pylint: disable=locally-disabled,too-few-public-methods
     #
     # Flask-Babel configurations.
     #
-    BABEL_DEFAULT_LOCALE   = hawat.const.HAWAT_DEFAULT_LOCALE
-    BABEL_DEFAULT_TIMEZONE = hawat.const.HAWAT_DEFAULT_TIMEZONE
+    BABEL_DEFAULT_LOCALE   = hawat.const.DEFAULT_LOCALE
+    BABEL_DEFAULT_TIMEZONE = hawat.const.DEFAULT_TIMEZONE
 
     #
     # Flask-SQLAlchemy configurations.
@@ -118,7 +118,7 @@ class Config:  # pylint: disable=locally-disabled,too-few-public-methods
     # Custom application configurations.
     #---------------------------------------------------------------------------
 
-    ROLES = hawat.const.HAWAT_ROLES
+    ROLES = hawat.const.ROLES
     """List of all valid user roles supported by the application."""
 
     SUPPORTED_LOCALES = collections.OrderedDict([
diff --git a/lib/hawat/const.py b/lib/hawat/const.py
index c821fede8..432fd5692 100644
--- a/lib/hawat/const.py
+++ b/lib/hawat/const.py
@@ -34,62 +34,71 @@ CRE_LANG_CODE = re.compile('^[a-zA-Z]{2}(_[a-zA-Z]{2})?$')
 """Compiled regular expression for validating language codes."""
 
 
-HAWAT_DEFAULT_LOCALE = 'en'
+DEFAULT_LOCALE = 'en'
 """Default application locale."""
 
-HAWAT_DEFAULT_TIMEZONE = 'UTC'
+DEFAULT_TIMEZONE = 'UTC'
 """Default application timezone."""
 
 
-HAWAT_FLASH_INFO    = 'info'
+FLASH_INFO    = 'info'
 """Class for *info* flash messages."""
 
-HAWAT_FLASH_SUCCESS = 'success'
+FLASH_SUCCESS = 'success'
 """Class for *success* flash messages."""
 
-HAWAT_FLASH_WARNING = 'warning'
+FLASH_WARNING = 'warning'
 """Class for *warning* flash messages."""
 
-HAWAT_FLASH_FAILURE = 'danger'
+FLASH_FAILURE = 'danger'
 """Class for *failure* flash messages."""
 
 
-HAWAT_ROLE_USER = 'user'
-"""Name of the 'user' role."""
-
-HAWAT_ROLE_DEVELOPER = 'developer'
-"""Name of the 'developer' role."""
-
-HAWAT_ROLE_MAINTAINER = 'maintainer'
-"""Name of the 'maintainer' role."""
-
-HAWAT_ROLE_ADMIN = 'admin'
-"""Name of the 'admin' role."""
+FORM_ACTION_SUBMIT = 'submit'
+"""Name of the item form *submit* button."""
 
-HAWAT_ROLES = [
-    HAWAT_ROLE_USER,
-    HAWAT_ROLE_DEVELOPER,
-    HAWAT_ROLE_MAINTAINER,
-    HAWAT_ROLE_ADMIN
-]
-"""List of valid user roles."""
+FORM_ACTION_CANCEL = 'cancel'
+"""Name of the item form *cancel* button."""
 
 
-HAWAT_ITEM_ACTION_CREATE = 'create'
+ACTION_ITEM_CREATE = 'create'
 """Name of the item *create* action."""
 
-HAWAT_ITEM_ACTION_CREATEFOR = 'createfor'
+ACTION_ITEM_CREATEFOR = 'createfor'
 """Name of the item *createfor* action."""
 
-HAWAT_ITEM_ACTION_UPDATE = 'update'
+ACTION_ITEM_UPDATE = 'update'
 """Name of the item *update* action."""
 
+ACTION_ITEM_ENABLE = 'enable'
+"""Name of the item *enable* action."""
 
-HAWAT_FORM_ACTION_SUBMIT = 'submit'
-"""Name of the item form *submit* button."""
+ACTION_ITEM_DISABLE = 'disable'
+"""Name of the item *disable* action."""
 
-HAWAT_FORM_ACTION_CANCEL = 'cancel'
-"""Name of the item form *cancel* button."""
+ACTION_ITEM_DELETE = 'delete'
+"""Name of the item *delete* action."""
+
+
+ROLE_USER = 'user'
+"""Name of the 'user' role."""
+
+ROLE_DEVELOPER = 'developer'
+"""Name of the 'developer' role."""
+
+ROLE_MAINTAINER = 'maintainer'
+"""Name of the 'maintainer' role."""
+
+ROLE_ADMIN = 'admin'
+"""Name of the 'admin' role."""
+
+ROLES = [
+    ROLE_USER,
+    ROLE_DEVELOPER,
+    ROLE_MAINTAINER,
+    ROLE_ADMIN
+]
+"""List of valid user roles."""
 
 
 CFGKEY_MENTAT_CORE = 'MENTAT_CORE'
@@ -107,10 +116,11 @@ CFGKEY_HAWAT_BLUEPRINTS   = 'HAWAT_BLUEPRINTS'
 CFGKEY_ENABLED_BLUEPRINTS = 'ENABLED_BLUEPRINTS'
 """Configuration key name: List of all requested blueprints."""
 
-HAWAT_DEFAULT_PAGER_LIMIT = 100
+
+DEFAULT_PAGER_LIMIT = 100
 """Default page limit for pager/paginator."""
 
-HAWAT_PAGER_LIMIT_CHOICES = [
+PAGER_LIMIT_CHOICES = [
     (5,5),
     (10,10),
     (20,20),
@@ -130,40 +140,45 @@ HAWAT_PAGER_LIMIT_CHOICES = [
 ]
 """List of available valid pager limit choices."""
 
-HAWAT_DEFAULT_RESULT_TIMEDELTA = 7
+DEFAULT_RESULT_TIMEDELTA = 7
 """Default result time delta for searching various objects."""
 
-RESOURCE_LOGIN_MANAGER = 'login_manager'
-"""Name for the ``flask_login.LoginManager`` object within the application resources."""
-
-RESOURCE_PRINCIPAL = 'principal'
-"""Name for the ``flask_principal.Principal`` object within the application resources."""
 
 RESOURCE_BABEL = 'babel'
 """Name for the ``flask_babel.Babel`` object within the application resources."""
 
+RESOURCE_LOGIN_MANAGER = 'login_manager'
+"""Name for the ``flask_login.LoginManager`` object within the application resources."""
+
 RESOURCE_MIGRATE = 'migrate'
 """Name for the ``flask_migrate.Migrate`` object within the application resources."""
 
+RESOURCE_PRINCIPAL = 'principal'
+"""Name for the ``flask_principal.Principal`` object within the application resources."""
+
+
 #
-# List of all existing Hawat context action search group names.
+# List of all existing Context Search Action Group names (CSAG).
 #
-HAWAT_CSAG_ABUSE    = 'abuses'
-HAWAT_CSAG_ADDRESS  = 'ips'
-HAWAT_CSAG_CATEGORY = 'categories'
-HAWAT_CSAG_CLASS    = 'classes'
-HAWAT_CSAG_DETECTOR = 'detectors'
-HAWAT_CSAG_DETTYPE  = 'detector_types'
-HAWAT_CSAG_HOSTTYPE = 'host_types'
-HAWAT_CSAG_PORT     = 'ports'
-HAWAT_CSAG_PROTOCOL = 'protocols'
-HAWAT_CSAG_SEVERITY = 'severities'
+CSAG_ABUSE    = 'abuses'
+CSAG_ADDRESS  = 'ips'
+CSAG_CATEGORY = 'categories'
+CSAG_CLASS    = 'classes'
+CSAG_DETECTOR = 'detectors'
+CSAG_DETTYPE  = 'detector_types'
+CSAG_HOSTTYPE = 'host_types'
+CSAG_PORT     = 'ports'
+CSAG_PROTOCOL = 'protocols'
+CSAG_SEVERITY = 'severities'
 
 #
-# List of all existing Hawat additonal object data service group names.
+# List of all existing Additonal Object Data Service names (AODS).
 #
-HAWAT_AODS_IP4  = 'ip4'
-HAWAT_AODS_IP6  = 'ip6'
+AODS_IP4 = 'ip4'
+AODS_IP6 = 'ip6'
+
+ICON_NAME_MISSING_ICON = 'missing-icon'
+"""Name of the icon to display instead of missing icons."""
 
 FA_ICONS = {
 
diff --git a/lib/hawat/errors.py b/lib/hawat/errors.py
index 93a9a5de8..174d7fc36 100644
--- a/lib/hawat/errors.py
+++ b/lib/hawat/errors.py
@@ -50,7 +50,7 @@ def _make_payload(status_code, message = None, exception = None):
         if hasattr(exception.__class__, 'description'):
             payload['message'] = exception.__class__.description
         # Append the whole exception object for developers to make debugging easier.
-        if current_user.is_authenticated and current_user.has_role(hawat.const.HAWAT_ROLE_DEVELOPER):
+        if current_user.is_authenticated and current_user.has_role(hawat.const.ROLE_DEVELOPER):
             payload['exception'] = exception
     return payload
 
diff --git a/lib/hawat/forms.py b/lib/hawat/forms.py
index e4022f7aa..8ef15f943 100644
--- a/lib/hawat/forms.py
+++ b/lib/hawat/forms.py
@@ -548,8 +548,8 @@ class BaseSearchForm(flask_wtf.FlaskForm):
             wtforms.validators.Optional()
         ],
         filters = [int],
-        choices = hawat.const.HAWAT_PAGER_LIMIT_CHOICES,
-        default = hawat.const.HAWAT_DEFAULT_PAGER_LIMIT
+        choices = hawat.const.PAGER_LIMIT_CHOICES,
+        default = hawat.const.DEFAULT_PAGER_LIMIT
     )
     page = wtforms.IntegerField(
         lazy_gettext('Page number:'),
-- 
GitLab