Stop including deform JS static files

although maybe we *should* be using that method, for some things?  can
revisit later if desired
This commit is contained in:
Lance Edgar 2023-02-03 18:06:40 -06:00
parent eb1351d108
commit 49122d940d
2 changed files with 25 additions and 16 deletions

View file

@ -24,12 +24,9 @@
Application Entry Point Application Entry Point
""" """
from __future__ import unicode_literals, absolute_import
import os import os
import warnings import warnings
import six
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker, scoped_session 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_mako')
config.include('pyramid_tm') 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 # bring in the pyramid_retry logic, if available
# TODO: pretty soon we can require this package, hopefully.. # TODO: pretty soon we can require this package, hopefully..
try: try:
@ -159,7 +166,7 @@ def make_pyramid_config(settings, configure_csrf=True):
# fetch all tailbone providers # fetch all tailbone providers
providers = get_all_providers(rattail_config) providers = get_all_providers(rattail_config)
for provider in six.itervalues(providers): for provider in providers.values():
# configure DB sessions associated with transaction manager # configure DB sessions associated with transaction manager
provider.configure_db_sessions(rattail_config, config) 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_config = config.registry.settings['rattail_config']
rattail_app = rattail_config.get_app() rattail_app = rattail_config.get_app()
if isinstance(view, six.string_types): if isinstance(view, str):
view_callable = rattail_app.load_object(view) view_callable = rattail_app.load_object(view)
else: else:
view_callable = view view_callable = view
@ -278,7 +285,7 @@ def establish_theme(settings):
settings['tailbone.theme'] = theme settings['tailbone.theme'] = theme
directories = settings['mako.directories'] directories = settings['mako.directories']
if isinstance(directories, six.string_types): if isinstance(directories, str):
directories = parse_list(directories) directories = parse_list(directories)
path = get_theme_template_path(rattail_config) path = get_theme_template_path(rattail_config)

View file

@ -60,16 +60,18 @@
${self.core_styles()} ${self.core_styles()}
${self.extra_styles()} ${self.extra_styles()}
## TODO: should this be elsewhere / more customizable? ## TODO: should leverage deform resources for component JS?
% if dform is not Undefined: ## cf. also tailbone.app.make_pyramid_config()
<% resources = dform.get_widget_resources() %> ## ## TODO: should this be elsewhere / more customizable?
% for path in resources['js']: ## % if dform is not Undefined:
${h.javascript_link(request.static_url(path))} ## <% resources = dform.get_widget_resources() %>
% endfor ## % for path in resources['js']:
% for path in resources['css']: ## ${h.javascript_link(request.static_url(path))}
${h.stylesheet_link(request.static_url(path))} ## % endfor
% endfor ## % for path in resources['css']:
% endif ## ${h.stylesheet_link(request.static_url(path))}
## % endfor
## % endif
</%def> </%def>
<%def name="core_javascript()"> <%def name="core_javascript()">