Compare commits
No commits in common. "7feaa844afcd389c9350fe49ad3db5df8c955575" and "f5ac66f264052c01d09f763b0e51a39deca98c1f" have entirely different histories.
7feaa844af
...
f5ac66f264
|
@ -5,12 +5,6 @@ All notable changes to wuttaweb will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## v0.8.1 (2024-08-15)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- improve backward compat for `util.get_liburl()`
|
|
||||||
|
|
||||||
## v0.8.0 (2024-08-15)
|
## v0.8.0 (2024-08-15)
|
||||||
|
|
||||||
### Feat
|
### Feat
|
||||||
|
|
|
@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "WuttaWeb"
|
name = "WuttaWeb"
|
||||||
version = "0.8.1"
|
version = "0.8.0"
|
||||||
description = "Web App for Wutta Framework"
|
description = "Web App for Wutta Framework"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
|
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
|
||||||
|
|
|
@ -27,7 +27,6 @@ Web Utilities
|
||||||
import importlib
|
import importlib
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import warnings
|
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
@ -154,24 +153,13 @@ def get_libver(
|
||||||
config = request.wutta_config
|
config = request.wutta_config
|
||||||
|
|
||||||
# nb. we prefer a setting to be named like: wuttaweb.libver.vue
|
# nb. we prefer a setting to be named like: wuttaweb.libver.vue
|
||||||
# but for back-compat this also can work: tailbone.libver.vue
|
# but for back-compat this also can work: wuttaweb.vue_version
|
||||||
# and for more back-compat this can work: wuttaweb.vue_version
|
|
||||||
# however that compat only works for some of the settings...
|
# however that compat only works for some of the settings...
|
||||||
|
|
||||||
if not default_only:
|
if not default_only:
|
||||||
|
|
||||||
# nb. new/preferred setting
|
# nb. new/preferred setting
|
||||||
version = config.get(f'wuttaweb.libver.{key}')
|
|
||||||
if version:
|
|
||||||
return version
|
|
||||||
|
|
||||||
# fallback to caller-specified prefix
|
|
||||||
if prefix != 'wuttaweb':
|
|
||||||
version = config.get(f'{prefix}.libver.{key}')
|
version = config.get(f'{prefix}.libver.{key}')
|
||||||
if version:
|
if version:
|
||||||
warnings.warn(f"config for {prefix}.libver.{key} is deprecated; "
|
|
||||||
f"please set wuttaweb.libver.{key} instead",
|
|
||||||
DeprecationWarning)
|
|
||||||
return version
|
return version
|
||||||
|
|
||||||
if key == 'buefy':
|
if key == 'buefy':
|
||||||
|
@ -179,9 +167,6 @@ def get_libver(
|
||||||
# nb. old/legacy setting
|
# nb. old/legacy setting
|
||||||
version = config.get(f'{prefix}.buefy_version')
|
version = config.get(f'{prefix}.buefy_version')
|
||||||
if version:
|
if version:
|
||||||
warnings.warn(f"config for {prefix}.buefy_version is deprecated; "
|
|
||||||
"please set wuttaweb.libver.buefy instead",
|
|
||||||
DeprecationWarning)
|
|
||||||
return version
|
return version
|
||||||
if not configured_only:
|
if not configured_only:
|
||||||
return 'latest'
|
return 'latest'
|
||||||
|
@ -197,9 +182,6 @@ def get_libver(
|
||||||
# nb. old/legacy setting
|
# nb. old/legacy setting
|
||||||
version = config.get(f'{prefix}.vue_version')
|
version = config.get(f'{prefix}.vue_version')
|
||||||
if version:
|
if version:
|
||||||
warnings.warn(f"config for {prefix}.vue_version is deprecated; "
|
|
||||||
"please set wuttaweb.libver.vue instead",
|
|
||||||
DeprecationWarning)
|
|
||||||
return version
|
return version
|
||||||
if not configured_only:
|
if not configured_only:
|
||||||
return '2.6.14'
|
return '2.6.14'
|
||||||
|
@ -311,35 +293,16 @@ def get_liburl(
|
||||||
config = request.wutta_config
|
config = request.wutta_config
|
||||||
|
|
||||||
if not default_only:
|
if not default_only:
|
||||||
|
|
||||||
# nb. new/preferred setting
|
|
||||||
url = config.get(f'wuttaweb.liburl.{key}')
|
|
||||||
if url:
|
|
||||||
return url
|
|
||||||
|
|
||||||
# fallback to caller-specified prefix
|
|
||||||
url = config.get(f'{prefix}.liburl.{key}')
|
url = config.get(f'{prefix}.liburl.{key}')
|
||||||
if url:
|
if url:
|
||||||
warnings.warn(f"config for {prefix}.liburl.{key} is deprecated; "
|
|
||||||
f"please set wuttaweb.liburl.{key} instead",
|
|
||||||
DeprecationWarning)
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
if configured_only:
|
if configured_only:
|
||||||
return
|
return
|
||||||
|
|
||||||
version = get_libver(request, key, prefix=prefix,
|
version = get_libver(request, key, prefix=prefix)
|
||||||
configured_only=False,
|
|
||||||
default_only=default_only)
|
|
||||||
|
|
||||||
# load fanstatic libcache if configured
|
|
||||||
static = config.get('wuttaweb.static_libcache.module')
|
static = config.get('wuttaweb.static_libcache.module')
|
||||||
if not static:
|
|
||||||
static = config.get(f'{prefix}.static_libcache.module')
|
|
||||||
if static:
|
|
||||||
warnings.warn(f"config for {prefix}.static_libcache.module is deprecated; "
|
|
||||||
"please set wuttaweb.static_libcache.module instead",
|
|
||||||
DeprecationWarning)
|
|
||||||
if static:
|
if static:
|
||||||
static = importlib.import_module(static)
|
static = importlib.import_module(static)
|
||||||
needed = request.environ['fanstatic.needed']
|
needed = request.environ['fanstatic.needed']
|
||||||
|
|
|
@ -59,11 +59,6 @@ class TestGetLibVer(TestCase):
|
||||||
version = util.get_libver(self.request, 'buefy')
|
version = util.get_libver(self.request, 'buefy')
|
||||||
self.assertEqual(version, '0.9.29')
|
self.assertEqual(version, '0.9.29')
|
||||||
|
|
||||||
def test_buefy_custom_old_tailbone(self):
|
|
||||||
self.config.setdefault('tailbone.libver.buefy', '0.9.28')
|
|
||||||
version = util.get_libver(self.request, 'buefy', prefix='tailbone')
|
|
||||||
self.assertEqual(version, '0.9.28')
|
|
||||||
|
|
||||||
def test_buefy_custom_new(self):
|
def test_buefy_custom_new(self):
|
||||||
self.config.setdefault('wuttaweb.libver.buefy', '0.9.29')
|
self.config.setdefault('wuttaweb.libver.buefy', '0.9.29')
|
||||||
version = util.get_libver(self.request, 'buefy')
|
version = util.get_libver(self.request, 'buefy')
|
||||||
|
@ -226,9 +221,8 @@ class TestGetLibUrl(TestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
testing.tearDown()
|
testing.tearDown()
|
||||||
|
|
||||||
def setup_fanstatic(self, register=True):
|
def setup_fanstatic(self):
|
||||||
self.pyramid_config.include('pyramid_fanstatic')
|
self.pyramid_config.include('pyramid_fanstatic')
|
||||||
if register:
|
|
||||||
self.config.setdefault('wuttaweb.static_libcache.module',
|
self.config.setdefault('wuttaweb.static_libcache.module',
|
||||||
'tests.test_util')
|
'tests.test_util')
|
||||||
|
|
||||||
|
@ -246,11 +240,6 @@ class TestGetLibUrl(TestCase):
|
||||||
url = util.get_liburl(self.request, 'buefy')
|
url = util.get_liburl(self.request, 'buefy')
|
||||||
self.assertEqual(url, '/lib/buefy.js')
|
self.assertEqual(url, '/lib/buefy.js')
|
||||||
|
|
||||||
def test_buefy_custom_tailbone(self):
|
|
||||||
self.config.setdefault('tailbone.liburl.buefy', '/tailbone/buefy.js')
|
|
||||||
url = util.get_liburl(self.request, 'buefy', prefix='tailbone')
|
|
||||||
self.assertEqual(url, '/tailbone/buefy.js')
|
|
||||||
|
|
||||||
def test_buefy_default_only(self):
|
def test_buefy_default_only(self):
|
||||||
self.config.setdefault('wuttaweb.liburl.buefy', '/lib/buefy.js')
|
self.config.setdefault('wuttaweb.liburl.buefy', '/lib/buefy.js')
|
||||||
url = util.get_liburl(self.request, 'buefy', default_only=True)
|
url = util.get_liburl(self.request, 'buefy', default_only=True)
|
||||||
|
@ -265,12 +254,6 @@ class TestGetLibUrl(TestCase):
|
||||||
url = util.get_liburl(self.request, 'buefy')
|
url = util.get_liburl(self.request, 'buefy')
|
||||||
self.assertEqual(url, '/wutta/fanstatic/buefy.js')
|
self.assertEqual(url, '/wutta/fanstatic/buefy.js')
|
||||||
|
|
||||||
def test_buefy_fanstatic_tailbone(self):
|
|
||||||
self.setup_fanstatic(register=False)
|
|
||||||
self.config.setdefault('tailbone.static_libcache.module', 'tests.test_util')
|
|
||||||
url = util.get_liburl(self.request, 'buefy', prefix='tailbone')
|
|
||||||
self.assertEqual(url, '/wutta/fanstatic/buefy.js')
|
|
||||||
|
|
||||||
def test_buefy_css_default(self):
|
def test_buefy_css_default(self):
|
||||||
url = util.get_liburl(self.request, 'buefy.css')
|
url = util.get_liburl(self.request, 'buefy.css')
|
||||||
self.assertEqual(url, 'https://unpkg.com/buefy@latest/dist/buefy.min.css')
|
self.assertEqual(url, 'https://unpkg.com/buefy@latest/dist/buefy.min.css')
|
||||||
|
|
Loading…
Reference in a new issue