From c4f735fda84e849c8527e1263e38126de0f3c602 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 19 Feb 2026 18:55:51 -0600 Subject: [PATCH] fix: make view responsible for App Info field/values that does not belong in the template, so custom apps can extend the list easier --- src/wuttaweb/templates/appinfo/index.mako | 29 ++------- src/wuttaweb/views/settings.py | 76 ++++++++++++++++++++++- 2 files changed, 80 insertions(+), 25 deletions(-) diff --git a/src/wuttaweb/templates/appinfo/index.mako b/src/wuttaweb/templates/appinfo/index.mako index d296389..b7beb8a 100644 --- a/src/wuttaweb/templates/appinfo/index.mako +++ b/src/wuttaweb/templates/appinfo/index.mako @@ -7,30 +7,11 @@

Application

- - ${app.get_distribution() or f'?? - set config for `{app.appname}.app_dist`'} - - - ${app.get_version() or f'?? - set config for `{app.appname}.app_dist`'} - - - ${app.get_title()} - - - ${app.get_node_title()} - - - ${config.appdb_engine.dialect.name} - - - ${app.get_timezone_name()} - - - ${"Yes" if config.production() else "No"} - - - ${"Yes" if app.get_email_handler().sending_is_enabled() else "No"} - + % for key, info in (appinfo or {}).items(): + + ${info["value"]} + + % endfor
diff --git a/src/wuttaweb/views/settings.py b/src/wuttaweb/views/settings.py index a1c9c1c..5b1e293 100644 --- a/src/wuttaweb/views/settings.py +++ b/src/wuttaweb/views/settings.py @@ -2,7 +2,7 @@ ################################################################################ # # wuttaweb -- Web App for Wutta Framework -# Copyright © 2024-2025 Lance Edgar +# Copyright © 2024-2026 Lance Edgar # # This file is part of Wutta Framework. # @@ -73,6 +73,80 @@ class AppInfoView(MasterView): # pylint: disable=abstract-method # TODO: for tailbone backward compat with get_liburl() etc. weblib_config_prefix = None + def get_template_context(self, context): # pylint: disable=empty-docstring + """ """ + if self.listing: + context["appinfo"] = self.get_appinfo_dict() + return context + + def get_appinfo_dict(self): # pylint: disable=missing-function-docstring + return OrderedDict( + [ + ( + "distribution", + { + "label": "Distribution", + "value": self.app.get_distribution() + or f"?? - set config for `{self.app.appname}.app_dist`", + }, + ), + ( + "version", + { + "label": "Version", + "value": self.app.get_version() + or f"?? - set config for `{self.app.appname}.app_dist`", + }, + ), + ( + "app_title", + { + "label": "App Title", + "value": self.app.get_title(), + }, + ), + ( + "node_title", + { + "label": "Node Title", + "value": self.app.get_node_title(), + }, + ), + ( + "db_backend", + { + "label": "DB Backend", + "value": self.config.appdb_engine.dialect.name, + }, + ), + ( + "timezone", + { + "label": "Timezone", + "value": self.app.get_timezone_name(), + }, + ), + ( + "production", + { + "label": "Production Mode", + "value": "Yes" if self.config.production() else "No", + }, + ), + ( + "email_enabled", + { + "label": "Email Enabled", + "value": ( + "Yes" + if self.app.get_email_handler().sending_is_enabled() + else "No" + ), + }, + ), + ] + ) + def get_grid_data( # pylint: disable=empty-docstring self, columns=None, session=None ):