3
0
Fork 0

Compare commits

...

2 commits

3 changed files with 51 additions and 34 deletions

View file

@ -5,6 +5,15 @@ 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.20.1 (2025-01-13)
### Fix
- expose setting to choose menu handler, in appinfo/configure
- use prop key instead of column name, for master view model key
- add grid filters specific to numeric, integer types
- use default value for config settings
## v0.20.0 (2025-01-11) ## v0.20.0 (2025-01-11)
### Feat ### Feat

View file

@ -6,7 +6,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "WuttaWeb" name = "WuttaWeb"
version = "0.20.0" version = "0.20.1"
description = "Web App for Wutta Framework" description = "Web App for Wutta Framework"
readme = "README.md" readme = "README.md"
authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}] authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}]
@ -44,7 +44,7 @@ dependencies = [
"pyramid_tm", "pyramid_tm",
"waitress", "waitress",
"WebHelpers2", "WebHelpers2",
"WuttJamaican[db]>=0.20.0", "WuttJamaican[db]>=0.20.1",
"zope.sqlalchemy>=1.5", "zope.sqlalchemy>=1.5",
] ]

View file

@ -1528,42 +1528,50 @@ class TestMasterView(WebTestCase):
get_index_url=MagicMock(return_value='/appinfo/'), get_index_url=MagicMock(return_value='/appinfo/'),
configure_get_simple_settings=MagicMock(return_value=settings)): configure_get_simple_settings=MagicMock(return_value=settings)):
# get the form page # nb. appinfo/configure template requires menu_handlers
response = view.configure(session=self.session) original_context = view.configure_get_context
self.assertIsInstance(response, Response) def get_context(**kw):
kw = original_context(**kw)
kw['menu_handlers'] = []
return kw
with patch.object(view, 'configure_get_context', new=get_context):
# post request to save settings # get the form page
self.request.method = 'POST' response = view.configure(session=self.session)
self.request.POST = { self.assertIsInstance(response, Response)
'wutta.app_title': 'Wutta',
'wutta.foo': 'bar',
'wutta.flag': 'true',
}
response = view.configure(session=self.session)
# nb. should get redirect back to configure page
self.assertEqual(response.status_code, 302)
# should now have 5 settings # post request to save settings
count = self.session.query(model.Setting).count() self.request.method = 'POST'
self.assertEqual(count, 5) self.request.POST = {
get_setting = functools.partial(self.app.get_setting, self.session) 'wutta.app_title': 'Wutta',
self.assertEqual(get_setting('wutta.app_title'), 'Wutta') 'wutta.foo': 'bar',
self.assertEqual(get_setting('wutta.foo'), 'bar') 'wutta.flag': 'true',
self.assertEqual(get_setting('wutta.flag'), 'true') }
self.assertEqual(get_setting('wutta.number'), '42') response = view.configure(session=self.session)
self.assertEqual(get_setting('wutta.value1'), '') # nb. should get redirect back to configure page
self.assertEqual(get_setting('wutta.value2'), None) self.assertEqual(response.status_code, 302)
# post request to remove settings # should now have 5 settings
self.request.method = 'POST' count = self.session.query(model.Setting).count()
self.request.POST = {'remove_settings': '1'} self.assertEqual(count, 5)
response = view.configure(session=self.session) get_setting = functools.partial(self.app.get_setting, self.session)
# nb. should get redirect back to configure page self.assertEqual(get_setting('wutta.app_title'), 'Wutta')
self.assertEqual(response.status_code, 302) self.assertEqual(get_setting('wutta.foo'), 'bar')
self.assertEqual(get_setting('wutta.flag'), 'true')
self.assertEqual(get_setting('wutta.number'), '42')
self.assertEqual(get_setting('wutta.value1'), '')
self.assertEqual(get_setting('wutta.value2'), None)
# should now have 0 settings # post request to remove settings
count = self.session.query(model.Setting).count() self.request.method = 'POST'
self.assertEqual(count, 0) self.request.POST = {'remove_settings': '1'}
response = view.configure(session=self.session)
# nb. should get redirect back to configure page
self.assertEqual(response.status_code, 302)
# should now have 0 settings
count = self.session.query(model.Setting).count()
self.assertEqual(count, 0)
def test_configure_gather_settings(self): def test_configure_gather_settings(self):
view = self.make_view() view = self.make_view()