From c6f0007908239f739f279f9945fd7b0bff725b16 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 4 Aug 2024 20:39:42 -0500 Subject: [PATCH] feat: add `wuttaweb.views.essential` module --- docs/api/wuttaweb/index.rst | 1 + docs/api/wuttaweb/views.essential.rst | 6 ++++ src/wuttaweb/views/__init__.py | 2 +- src/wuttaweb/views/essential.py | 43 +++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 docs/api/wuttaweb/views.essential.rst create mode 100644 src/wuttaweb/views/essential.py diff --git a/docs/api/wuttaweb/index.rst b/docs/api/wuttaweb/index.rst index 6b305cf..5a65f11 100644 --- a/docs/api/wuttaweb/index.rst +++ b/docs/api/wuttaweb/index.rst @@ -20,3 +20,4 @@ views views.base views.common + views.essential diff --git a/docs/api/wuttaweb/views.essential.rst b/docs/api/wuttaweb/views.essential.rst new file mode 100644 index 0000000..79c0b57 --- /dev/null +++ b/docs/api/wuttaweb/views.essential.rst @@ -0,0 +1,6 @@ + +``wuttaweb.views.essential`` +============================ + +.. automodule:: wuttaweb.views.essential + :members: diff --git a/src/wuttaweb/views/__init__.py b/src/wuttaweb/views/__init__.py index 0b62a83..68fdd77 100644 --- a/src/wuttaweb/views/__init__.py +++ b/src/wuttaweb/views/__init__.py @@ -33,4 +33,4 @@ from .base import View def includeme(config): - config.include('wuttaweb.views.common') + config.include('wuttaweb.views.essential') diff --git a/src/wuttaweb/views/essential.py b/src/wuttaweb/views/essential.py new file mode 100644 index 0000000..a9272f4 --- /dev/null +++ b/src/wuttaweb/views/essential.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8; -*- +################################################################################ +# +# wuttaweb -- Web App for Wutta Framework +# Copyright © 2024 Lance Edgar +# +# This file is part of Wutta Framework. +# +# Wutta Framework is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) any +# later version. +# +# Wutta Framework is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# Wutta Framework. If not, see . +# +################################################################################ +""" +Essential views for convenient includes + +Most apps should include this module:: + + pyramid_config.include('wuttaweb.views.essential') + +That will in turn include the following modules: + +* :mod:`wuttaweb.views.common` +""" + + +def defaults(config, **kwargs): + mod = lambda spec: kwargs.get(spec, spec) + + config.include(mod('wuttaweb.views.common')) + + +def includeme(config): + defaults(config)