From 49122d940d242242850d27bd46254a9e0634b9ca Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 3 Feb 2023 18:06:40 -0600 Subject: [PATCH] Stop including deform JS static files although maybe we *should* be using that method, for some things? can revisit later if desired --- tailbone/app.py | 19 +++++++++++++------ tailbone/templates/base.mako | 22 ++++++++++++---------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/tailbone/app.py b/tailbone/app.py index 9e8348bc..4d4f435c 100644 --- a/tailbone/app.py +++ b/tailbone/app.py @@ -24,12 +24,9 @@ Application Entry Point """ -from __future__ import unicode_literals, absolute_import - import os import warnings -import six import sqlalchemy as sa from sqlalchemy.orm import sessionmaker, scoped_session @@ -148,6 +145,16 @@ def make_pyramid_config(settings, configure_csrf=True): config.include('pyramid_mako') config.include('pyramid_tm') + # TODO: this may be a good idea some day, if wanting to leverage + # deform resources for component JS? cf. also base.mako template + # # override default script mapping for deform + # from deform import Field + # from deform.widget import ResourceRegistry, default_resources + # registry = ResourceRegistry(use_defaults=False) + # for key in default_resources: + # registry.set_js_resources(key, None, {'js': []}) + # Field.set_default_resource_registry(registry) + # bring in the pyramid_retry logic, if available # TODO: pretty soon we can require this package, hopefully.. try: @@ -159,7 +166,7 @@ def make_pyramid_config(settings, configure_csrf=True): # fetch all tailbone providers providers = get_all_providers(rattail_config) - for provider in six.itervalues(providers): + for provider in providers.values(): # configure DB sessions associated with transaction manager provider.configure_db_sessions(rattail_config, config) @@ -193,7 +200,7 @@ def add_websocket(config, name, view, attr=None): rattail_config = config.registry.settings['rattail_config'] rattail_app = rattail_config.get_app() - if isinstance(view, six.string_types): + if isinstance(view, str): view_callable = rattail_app.load_object(view) else: view_callable = view @@ -278,7 +285,7 @@ def establish_theme(settings): settings['tailbone.theme'] = theme directories = settings['mako.directories'] - if isinstance(directories, six.string_types): + if isinstance(directories, str): directories = parse_list(directories) path = get_theme_template_path(rattail_config) diff --git a/tailbone/templates/base.mako b/tailbone/templates/base.mako index 150b052c..f4935113 100644 --- a/tailbone/templates/base.mako +++ b/tailbone/templates/base.mako @@ -60,16 +60,18 @@ ${self.core_styles()} ${self.extra_styles()} - ## TODO: should this be elsewhere / more customizable? - % if dform is not Undefined: - <% resources = dform.get_widget_resources() %> - % for path in resources['js']: - ${h.javascript_link(request.static_url(path))} - % endfor - % for path in resources['css']: - ${h.stylesheet_link(request.static_url(path))} - % endfor - % endif + ## TODO: should leverage deform resources for component JS? + ## cf. also tailbone.app.make_pyramid_config() +## ## TODO: should this be elsewhere / more customizable? +## % if dform is not Undefined: +## <% resources = dform.get_widget_resources() %> +## % for path in resources['js']: +## ${h.javascript_link(request.static_url(path))} +## % endfor +## % for path in resources['css']: +## ${h.stylesheet_link(request.static_url(path))} +## % endfor +## % endif <%def name="core_javascript()">