From a0f4bde54ad442270cf3e7cc17d5db692aeba59d Mon Sep 17 00:00:00 2001 From: Jan Mach <jan.mach@cesnet.cz> Date: Tue, 19 Feb 2019 14:19:21 +0100 Subject: [PATCH] Refactoring: Renamed HawatRenderableView to RenderableView. The original name was unnecessarily long. (Redmine issue: #3443) --- lib/hawat/base.py | 22 ++++++++++---------- lib/hawat/blueprints/auth_api/__init__.py | 4 ++-- lib/hawat/blueprints/auth_env/__init__.py | 6 +++--- lib/hawat/blueprints/dbstatus/__init__.py | 6 +++--- lib/hawat/blueprints/events/__init__.py | 6 +++--- lib/hawat/blueprints/filters/__init__.py | 4 ++-- lib/hawat/blueprints/geoip/__init__.py | 4 ++-- lib/hawat/blueprints/groups/__init__.py | 4 ++-- lib/hawat/blueprints/performance/__init__.py | 2 +- lib/hawat/blueprints/reports/__init__.py | 8 +++---- lib/hawat/blueprints/skeleton/__init__.py | 2 +- lib/hawat/blueprints/status/__init__.py | 2 +- lib/hawat/blueprints/timeline/__init__.py | 2 +- lib/hawat/blueprints/users/__init__.py | 4 ++-- lib/hawat/blueprints/whois/__init__.py | 4 ++-- 15 files changed, 40 insertions(+), 40 deletions(-) diff --git a/lib/hawat/base.py b/lib/hawat/base.py index e866ccb89..0ae3fefd2 100644 --- a/lib/hawat/base.py +++ b/lib/hawat/base.py @@ -30,7 +30,7 @@ Module contents * :py:class:`FileNameView` * :py:class:`FileIdView` - * :py:class:`HawatRenderableView` + * :py:class:`RenderableView` * :py:class:`HawatSimpleView` * :py:class:`HawatSearchView` @@ -422,7 +422,7 @@ class HawatBlueprint(flask.Blueprint): class HTMLMixin: """ Mixin class enabling rendering responses as HTML. Use it in your custom view - classess based on :py:class:`hawat.base.HawatRenderableView` to provide the + classess based on :py:class:`hawat.base.RenderableView` to provide the ability to render Jinja2 template files into HTML responses. """ @@ -473,7 +473,7 @@ class HTMLMixin: class AJAXMixin: """ Mixin class enabling rendering responses as JSON documents. Use it in your - custom view classess based on based on :py:class:`hawat.base.HawatRenderableView` + custom view classess based on based on :py:class:`hawat.base.RenderableView` to provide the ability to generate JSON responses. """ @@ -1008,7 +1008,7 @@ class FileIdView(BaseView): ) -class HawatRenderableView(BaseView): # pylint: disable=locally-disabled,abstract-method +class RenderableView(BaseView): # pylint: disable=locally-disabled,abstract-method """ Base class for all views, that are rendering content based on Jinja2 templates or returning JSON/XML data. @@ -1092,14 +1092,14 @@ class HawatRenderableView(BaseView): # pylint: disable=locally-disabled,abstrac raise NotImplementedError() -class HawatSimpleView(HawatRenderableView): # pylint: disable=locally-disabled,abstract-method +class HawatSimpleView(RenderableView): # pylint: disable=locally-disabled,abstract-method """ Base class for simple views. These are the most, well, simple views, that are rendering single template file or directly returning some JSON/XML data without any user parameters. In most use cases, it should be enough to just enhance the default implementation - of :py:func:`hawat.base.HawatRenderableView.get_response_context` to inject + of :py:func:`hawat.base.RenderableView.get_response_context` to inject some additional variables into the template. """ @@ -1112,7 +1112,7 @@ class HawatSimpleView(HawatRenderableView): # pylint: disable=locally-disabled, return self.generate_response() -class HawatSearchView(HawatRenderableView, HawatUtils): +class HawatSearchView(RenderableView, HawatUtils): """ Base class for search views. """ @@ -1357,7 +1357,7 @@ class HawatSearchView(HawatRenderableView, HawatUtils): return self.generate_response() -class HawatItemListView(HawatRenderableView): # pylint: disable=locally-disabled,abstract-method +class HawatItemListView(RenderableView): # pylint: disable=locally-disabled,abstract-method """ Base class for item *list* views. These views provide quick and simple access to lists of all objects. @@ -1426,7 +1426,7 @@ class HawatItemListView(HawatRenderableView): # pylint: disable=locally-disable return self.generate_response() -class HawatItemShowView(HawatRenderableView): # pylint: disable=locally-disabled,abstract-method +class HawatItemShowView(RenderableView): # pylint: disable=locally-disabled,abstract-method """ Base class for item *show* views. These views expect unique item identifier as parameter and are supposed to display specific information about single @@ -1529,7 +1529,7 @@ class HawatItemShowView(HawatRenderableView): # pylint: disable=locally-disable return self.generate_response() -class HawatItemActionView(HawatRenderableView): # pylint: disable=locally-disabled,abstract-method +class HawatItemActionView(RenderableView): # pylint: disable=locally-disabled,abstract-method """ Base class for item action views. These views perform various actions (create/update/delete) with given item class. @@ -1556,7 +1556,7 @@ class HawatItemActionView(HawatRenderableView): # pylint: disable=locally-disab @classmethod def get_view_template(cls): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.get_view_template`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.get_view_template`. """ return 'form_{}.html'.format( cls.get_view_name().replace('-', '_') diff --git a/lib/hawat/blueprints/auth_api/__init__.py b/lib/hawat/blueprints/auth_api/__init__.py index 64a20ad3f..c097452b7 100644 --- a/lib/hawat/blueprints/auth_api/__init__.py +++ b/lib/hawat/blueprints/auth_api/__init__.py @@ -78,7 +78,7 @@ class GenerateKeyView(HTMLMixin, SQLAlchemyMixin, HawatItemChangeView): # pylin @classmethod def get_view_template(cls): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.get_view_template`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.get_view_template`. """ return 'auth_api/key-generate.html' @@ -160,7 +160,7 @@ class DeleteKeyView(HTMLMixin, SQLAlchemyMixin, HawatItemChangeView): # pylint: @classmethod def get_view_template(cls): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.get_view_template`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.get_view_template`. """ return 'auth_api/key-delete.html' diff --git a/lib/hawat/blueprints/auth_env/__init__.py b/lib/hawat/blueprints/auth_env/__init__.py index dc3b45638..0b7f7a8b1 100644 --- a/lib/hawat/blueprints/auth_env/__init__.py +++ b/lib/hawat/blueprints/auth_env/__init__.py @@ -99,7 +99,7 @@ from mentat.datatype.sqldb import ItemChangeLogModel import hawat.const import hawat.db import hawat.forms -from hawat.base import HTMLMixin, SQLAlchemyMixin, HawatRenderableView, HawatBlueprint +from hawat.base import HTMLMixin, SQLAlchemyMixin, RenderableView, HawatBlueprint from hawat.models.user import GuiUserModel from hawat.blueprints.auth_env.forms import RegisterUserAccountForm @@ -129,7 +129,7 @@ def get_login_from_environment(): flask.request.environ.get('REMOTE_USER', None) ) -class LoginView(HTMLMixin, HawatRenderableView): +class LoginView(HTMLMixin, RenderableView): """ View responsible for user login via application environment. """ @@ -235,7 +235,7 @@ class LoginView(HTMLMixin, HawatRenderableView): ) -class RegisterView(HTMLMixin, SQLAlchemyMixin, HawatRenderableView): +class RegisterView(HTMLMixin, SQLAlchemyMixin, RenderableView): """ View responsible for registering new user account into application. """ diff --git a/lib/hawat/blueprints/dbstatus/__init__.py b/lib/hawat/blueprints/dbstatus/__init__.py index 1e59f2645..c539a6475 100644 --- a/lib/hawat/blueprints/dbstatus/__init__.py +++ b/lib/hawat/blueprints/dbstatus/__init__.py @@ -119,7 +119,7 @@ class ViewView(HTMLMixin, HawatSimpleView): def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ self.response_context.update( database_status_events = hawat.events.db_get().database_status(), @@ -177,7 +177,7 @@ class DashboardView(HTMLMixin, SQLAlchemyMixin, HawatSimpleView): # pylint: dis @classmethod def get_view_template(cls): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.get_view_template`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.get_view_template`. """ return '{}/dashboard.html'.format(cls.module_name) @@ -186,7 +186,7 @@ class DashboardView(HTMLMixin, SQLAlchemyMixin, HawatSimpleView): # pylint: dis def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ self.response_context['users_disabled'] = self.dbquery(GuiUserModel).\ filter(GuiUserModel.enabled == False).\ diff --git a/lib/hawat/blueprints/events/__init__.py b/lib/hawat/blueprints/events/__init__.py index f6d655736..1b398f50d 100644 --- a/lib/hawat/blueprints/events/__init__.py +++ b/lib/hawat/blueprints/events/__init__.py @@ -845,7 +845,7 @@ class AbstractDashboardView(SQLAlchemyMixin, HawatSearchView): # pylint: disabl @classmethod def get_view_template(cls): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.get_view_template`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.get_view_template`. """ return '{}/{}.html'.format(cls.module_name, cls.get_view_name()) @@ -915,7 +915,7 @@ class AbstractDashboardView(SQLAlchemyMixin, HawatSearchView): # pylint: disabl def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ self.response_context.update( quicksearch_list = self.get_quicksearch_by_time() @@ -974,7 +974,7 @@ class APIMetadataView(AJAXMixin, HawatSimpleView): def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ self.response_context.update(**_get_enums()) diff --git a/lib/hawat/blueprints/filters/__init__.py b/lib/hawat/blueprints/filters/__init__.py index 2cdb33248..25a7ee6e1 100644 --- a/lib/hawat/blueprints/filters/__init__.py +++ b/lib/hawat/blueprints/filters/__init__.py @@ -57,7 +57,7 @@ import hawat.db import hawat.events from hawat.base import HTMLMixin, SQLAlchemyMixin, HawatItemListView,\ HawatItemShowView, HawatItemCreateView, HawatItemCreateForView, HawatItemUpdateView,\ - HawatItemEnableView, HawatItemDisableView, HawatItemDeleteView, HawatRenderableView, HawatBlueprint + HawatItemEnableView, HawatItemDisableView, HawatItemDeleteView, RenderableView, HawatBlueprint from hawat.blueprints.filters.forms import BaseFilterForm, AdminFilterForm, PlaygroundFilterForm @@ -823,7 +823,7 @@ class DeleteView(HTMLMixin, SQLAlchemyMixin, HawatItemDeleteView): # pylint: di return gettext('Canceled deleting reporting filter <strong>%(item_id)s</strong> for group <strong>%(parent_id)s</strong>.', item_id = str(kwargs['item']), parent_id = str(kwargs['item'].group)) -class PlaygroundView(HTMLMixin, HawatRenderableView): +class PlaygroundView(HTMLMixin, RenderableView): """ Reporting filter playground view. """ diff --git a/lib/hawat/blueprints/geoip/__init__.py b/lib/hawat/blueprints/geoip/__init__.py index 18847dea1..a25339231 100644 --- a/lib/hawat/blueprints/geoip/__init__.py +++ b/lib/hawat/blueprints/geoip/__init__.py @@ -47,7 +47,7 @@ from mentat.const import tr_ import hawat.const import hawat.db import hawat.acl -from hawat.base import HTMLMixin, HawatRenderableView, HawatBlueprint, URLParamsBuilder +from hawat.base import HTMLMixin, RenderableView, HawatBlueprint, URLParamsBuilder from hawat.blueprints.geoip.forms import GeoipSearchForm @@ -55,7 +55,7 @@ BLUEPRINT_NAME = 'geoip' """Name of the blueprint as module global constant.""" -class SearchView(HTMLMixin, HawatRenderableView): +class SearchView(HTMLMixin, RenderableView): """ Application view providing search form for internal IP geolocation service and appropriate result page. diff --git a/lib/hawat/blueprints/groups/__init__.py b/lib/hawat/blueprints/groups/__init__.py index e8279a0b7..e98d48791 100644 --- a/lib/hawat/blueprints/groups/__init__.py +++ b/lib/hawat/blueprints/groups/__init__.py @@ -241,7 +241,7 @@ class ShowView(HTMLMixin, SQLAlchemyMixin, HawatItemShowView): def do_before_response(self, **kwargs): # pylint: disable=locally-disabled,no-self-use,unused-argument """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ action_menu = hawat.menu.HawatMenu() action_menu.add_entry( @@ -328,7 +328,7 @@ class ShowByNameView(ShowView): # pylint: disable=locally-disabled,too-many-anc @classmethod def get_view_template(cls): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.get_view_template`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.get_view_template`. """ return '{}/show.html'.format(cls.module_name) diff --git a/lib/hawat/blueprints/performance/__init__.py b/lib/hawat/blueprints/performance/__init__.py index ec03653e9..6180965fa 100644 --- a/lib/hawat/blueprints/performance/__init__.py +++ b/lib/hawat/blueprints/performance/__init__.py @@ -75,7 +75,7 @@ class ViewView(HTMLMixin, HawatSimpleView): def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ rrd_stats = mentat.stats.rrd.RrdStats(RRD_DB_DIR, RRD_REPORTS_DIR) charts = rrd_stats.lookup() diff --git a/lib/hawat/blueprints/reports/__init__.py b/lib/hawat/blueprints/reports/__init__.py index 3b6121359..0a7b879f7 100644 --- a/lib/hawat/blueprints/reports/__init__.py +++ b/lib/hawat/blueprints/reports/__init__.py @@ -308,7 +308,7 @@ class ShowView(HTMLMixin, SQLAlchemyMixin, HawatItemShowView): def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ if 'item' in self.response_context and self.response_context['item']: self.response_context.update( @@ -334,7 +334,7 @@ class UnauthShowView(ShowView): # pylint: disable=locally-disabled,too-many-anc @classmethod def get_view_template(cls): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.get_view_template`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.get_view_template`. """ return '{}/show.html'.format(cls.module_name) @@ -436,7 +436,7 @@ class DashboardView(HTMLMixin, SQLAlchemyMixin, HawatSearchView): # pylint: dis @classmethod def get_view_template(cls): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.get_view_template`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.get_view_template`. """ return '{}/dashboard.html'.format(cls.module_name) @@ -502,7 +502,7 @@ class DashboardView(HTMLMixin, SQLAlchemyMixin, HawatSearchView): # pylint: dis def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ self.response_context.update( quicksearch_list = self.get_quicksearch_by_time() diff --git a/lib/hawat/blueprints/skeleton/__init__.py b/lib/hawat/blueprints/skeleton/__init__.py index c600fe57a..39f612c18 100644 --- a/lib/hawat/blueprints/skeleton/__init__.py +++ b/lib/hawat/blueprints/skeleton/__init__.py @@ -73,7 +73,7 @@ class ExampleView(hawat.base.HTMLMixin, hawat.base.HawatSimpleView): def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ pass diff --git a/lib/hawat/blueprints/status/__init__.py b/lib/hawat/blueprints/status/__init__.py index dc13bc9a2..9a4f04731 100644 --- a/lib/hawat/blueprints/status/__init__.py +++ b/lib/hawat/blueprints/status/__init__.py @@ -92,7 +92,7 @@ class ViewView(HTMLMixin, HawatSimpleView): def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ controller_cfg = pyzenkit.jsonconf.json_load( flask.current_app.config['MENTAT_CONTROLLER_CFG'], diff --git a/lib/hawat/blueprints/timeline/__init__.py b/lib/hawat/blueprints/timeline/__init__.py index 1856fc616..92c3f3722 100644 --- a/lib/hawat/blueprints/timeline/__init__.py +++ b/lib/hawat/blueprints/timeline/__init__.py @@ -260,7 +260,7 @@ class AbstractSearchView(PsycopgMixin, HawatSearchView): # pylint: disable=loca def do_before_response(self, **kwargs): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ self.response_context.update( quicksearch_list = self.get_quicksearch_by_time() diff --git a/lib/hawat/blueprints/users/__init__.py b/lib/hawat/blueprints/users/__init__.py index e6ca6455d..cd9d691bc 100644 --- a/lib/hawat/blueprints/users/__init__.py +++ b/lib/hawat/blueprints/users/__init__.py @@ -219,7 +219,7 @@ class ShowView(HTMLMixin, SQLAlchemyMixin, HawatItemShowView): def do_before_response(self, **kwargs): # pylint: disable=locally-disabled,no-self-use,unused-argument """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.do_before_response`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.do_before_response`. """ action_menu = hawat.menu.HawatMenu() action_menu.add_entry( @@ -300,7 +300,7 @@ class MeView(ShowView): # pylint: disable=locally-disabled,too-many-ancestors @classmethod def get_view_template(cls): """ - *Interface implementation* of :py:func:`hawat.base.HawatRenderableView.get_view_template`. + *Interface implementation* of :py:func:`hawat.base.RenderableView.get_view_template`. """ return '{}/show.html'.format(BLUEPRINT_NAME) diff --git a/lib/hawat/blueprints/whois/__init__.py b/lib/hawat/blueprints/whois/__init__.py index 17ebd7a67..01d6c410e 100644 --- a/lib/hawat/blueprints/whois/__init__.py +++ b/lib/hawat/blueprints/whois/__init__.py @@ -53,7 +53,7 @@ from mentat.const import tr_ import hawat.db import hawat.acl -from hawat.base import HTMLMixin, HawatRenderableView, HawatBlueprint, URLParamsBuilder +from hawat.base import HTMLMixin, RenderableView, HawatBlueprint, URLParamsBuilder from hawat.blueprints.whois.forms import WhoisSearchForm @@ -61,7 +61,7 @@ BLUEPRINT_NAME = 'whois' """Name of the blueprint as module global constant.""" -class SearchView(HTMLMixin, HawatRenderableView): +class SearchView(HTMLMixin, RenderableView): """ Application view providing search form for internal whois resolving service and appropriate result page. -- GitLab