3
0
Fork 0

Compare commits

..

No commits in common. "e9507fb5a468a66f44fa0564dc5329aa299096cc" and "7002986cb7e7ff96078e669e405f275c67cef721" have entirely different histories.

10 changed files with 24 additions and 79 deletions

View file

@ -5,12 +5,6 @@ All notable changes to WuttJamaican will be documented in this file.
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).
## v0.13.2 (2024-08-27)
### Fix
- add basic support for wutta-continuum data versioning/history
## v0.13.1 (2024-08-27)
### Fix

View file

@ -35,7 +35,6 @@ intersphinx_mapping = {
'rattail': ('https://rattailproject.org/docs/rattail/', None),
'rattail-manual': ('https://rattailproject.org/docs/rattail-manual/', None),
'sqlalchemy': ('http://docs.sqlalchemy.org/en/latest/', None),
'wutta-continuum': ('https://rattailproject.org/docs/wutta-continuum/', None),
}

View file

@ -2,12 +2,18 @@
WuttJamaican
============
This package aims to provide a "base layer" for apps regardless of
platform or environment (console, web, GUI).
This package provides a "base layer" for custom apps, regardless of
environment/platform:
It comes from patterns developed within the `Rattail Project`_, and
roughly corresponds with the "base and data layers" as described in
:doc:`rattail-manual:index`.
* console
* web
* GUI
It mostly is a distillation of certain patterns developed within the
`Rattail Project`_, which are deemed generally useful. (At least,
according to the author.) It roughly corresponds to the "base layer"
as described in the Rattail Manual (see
:doc:`rattail-manual:base/index`).
.. _Rattail Project: https://rattailproject.org/
@ -16,6 +22,9 @@ project.
.. _test coverage: https://buildbot.rattailproject.org/coverage/wuttjamaican/
Rattail is still the main use case so far, and will be refactored
along the way to incorporate what this package has to offer.
Features
--------
@ -26,11 +35,6 @@ Features
.. _SQLAlchemy: https://www.sqlalchemy.org
See also these projects which build on WuttJamaican:
* :doc:`wutta-continuum:index`
* `WuttaWeb <https://rattailproject.org/docs/wuttaweb/>`_
Contents
--------

View file

@ -6,7 +6,7 @@ build-backend = "hatchling.build"
[project]
name = "WuttJamaican"
version = "0.13.2"
version = "0.13.1"
description = "Base package for Wutta Framework"
readme = "README.md"
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]

View file

@ -590,21 +590,6 @@ class AppHandler:
if setting:
session.delete(setting)
def continuum_is_enabled(self):
"""
Returns boolean indicating if Wutta-Continuum is installed and
enabled.
Default will be ``False`` as enabling it requires additional
installation and setup. For instructions see
:doc:`wutta-continuum:narr/install`.
"""
for provider in self.providers.values():
if hasattr(provider, 'continuum_is_enabled'):
return provider.continuum_is_enabled()
return False
##############################
# getters for other handlers
##############################

View file

@ -625,7 +625,7 @@ class WuttaConfig:
class WuttaConfigExtension:
"""
Base class for all :term:`config extensions <config extension>`.
Base class for all config extensions.
"""
key = None
@ -638,17 +638,6 @@ class WuttaConfigExtension:
object in any way necessary.
"""
def startup(self, config):
"""
This method is called after the config object is fully created
and all extensions have been applied, i.e. after
:meth:`configure()` has been called for each extension.
At this point the config *settings* for the running app should
be settled, and each extension is then allowed to act on those
initial settings if needed.
"""
def generic_default_files(appname):
"""
@ -973,13 +962,8 @@ def make_config(
# apply all registered extensions
# TODO: maybe let config disable some extensions?
extensions = load_entry_points(extension_entry_points)
extensions = [ext() for ext in extensions.values()]
for extension in extensions:
for extension in extensions.values():
log.debug("applying config extension: %s", extension.key)
extension.configure(config)
# let extensions run startup hooks if needed
for extension in extensions:
extension.startup(config)
extension().configure(config)
return config

View file

@ -65,7 +65,6 @@ class Role(Base):
See also :attr:`user_refs`.
"""
__tablename__ = 'role'
__versioned__ = {}
uuid = uuid_column()
@ -123,7 +122,6 @@ class Permission(Base):
Represents a permission granted to a role.
"""
__tablename__ = 'permission'
__versioned__ = {}
role_uuid = uuid_fk_column('role.uuid', primary_key=True, nullable=False)
role = orm.relationship(
@ -157,7 +155,6 @@ class User(Base):
See also :attr:`role_refs`.
"""
__tablename__ = 'user'
__versioned__ = {}
uuid = uuid_column()
@ -220,7 +217,6 @@ class UserRole(Base):
user "belongs" or "is assigned" to the role.
"""
__tablename__ = 'user_x_role'
__versioned__ = {}
uuid = uuid_column()

View file

@ -118,7 +118,6 @@ class Person(Base):
Employee relationship etc.
"""
__tablename__ = 'person'
__versioned__ = {}
uuid = uuid_column()

View file

@ -200,19 +200,6 @@ class TestAppHandler(FileTestCase):
value = self.app.get_setting(session, 'foo')
self.assertIsNone(value)
def test_continuum_is_enabled(self):
# false by default
with patch.object(self.app, 'providers', new={}):
self.assertFalse(self.app.continuum_is_enabled())
# but "any" provider technically could enable it...
class MockProvider:
def continuum_is_enabled(self):
return True
with patch.object(self.app, 'providers', new={'mock': MockProvider()}):
self.assertTrue(self.app.continuum_is_enabled())
def test_model(self):
try:
from wuttjamaican.db import model

View file

@ -7,8 +7,6 @@ from unittest.mock import patch, MagicMock
import pytest
from wuttjamaican import conf as mod
# TODO: get rid of this eventually
from wuttjamaican import conf
from wuttjamaican.exc import ConfigurationError
from wuttjamaican.app import AppHandler
@ -675,11 +673,11 @@ class TestMakeConfig(FileTestCase):
generic = self.write_file('generic.conf', '')
myfile = self.write_file('my.conf', '')
with patch.object(mod, 'WuttaConfig') as WuttaConfig:
with patch.object(mod, 'load_entry_points') as load_entry_points:
with patch('wuttjamaican.conf.WuttaConfig') as WuttaConfig:
with patch('wuttjamaican.conf.load_entry_points') as load_entry_points:
# no entry points loaded if extend=False
config = mod.make_config(appname='wuttatest', extend=False)
config = conf.make_config(appname='wuttatest', extend=False)
WuttaConfig.assert_called_once_with([], appname='wuttatest',
usedb=None, preferdb=None)
load_entry_points.assert_not_called()
@ -687,7 +685,7 @@ class TestMakeConfig(FileTestCase):
# confirm entry points for default appname
load_entry_points.reset_mock()
WuttaConfig.reset_mock()
config = mod.make_config([], appname='wutta')
config = conf.make_config([], appname='wutta')
WuttaConfig.assert_called_once_with([], appname='wutta',
usedb=None, preferdb=None)
load_entry_points.assert_called_once_with('wutta.config.extensions')
@ -695,7 +693,7 @@ class TestMakeConfig(FileTestCase):
# confirm entry points for custom appname
load_entry_points.reset_mock()
WuttaConfig.reset_mock()
config = mod.make_config(appname='wuttatest')
config = conf.make_config(appname='wuttatest')
WuttaConfig.assert_called_once_with([], appname='wuttatest',
usedb=None, preferdb=None)
load_entry_points.assert_called_once_with('wuttatest.config.extensions')
@ -708,10 +706,9 @@ class TestMakeConfig(FileTestCase):
WuttaConfig.reset_mock()
testconfig = MagicMock()
WuttaConfig.return_value = testconfig
config = mod.make_config(appname='wuttatest')
config = conf.make_config(appname='wuttatest')
WuttaConfig.assert_called_once_with([], appname='wuttatest',
usedb=None, preferdb=None)
load_entry_points.assert_called_once_with('wuttatest.config.extensions')
foo_cls.assert_called_once_with()
foo_obj.configure.assert_called_once_with(testconfig)
foo_obj.startup.assert_called_once_with(testconfig)