diff --git a/docs/api/sideshow.web.views.common.rst b/docs/api/sideshow.web.views.common.rst deleted file mode 100644 index 79ed2d2..0000000 --- a/docs/api/sideshow.web.views.common.rst +++ /dev/null @@ -1,6 +0,0 @@ - -``sideshow.web.views.common`` -============================= - -.. automodule:: sideshow.web.views.common - :members: diff --git a/docs/index.rst b/docs/index.rst index 29882dd..04b7099 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,7 +22,6 @@ For an online demo see https://demo.wuttaproject.org/ narr/overview glossary - narr/install narr/cli/index .. toctree:: @@ -54,7 +53,6 @@ For an online demo see https://demo.wuttaproject.org/ api/sideshow.web.views api/sideshow.web.views.batch api/sideshow.web.views.batch.neworder - api/sideshow.web.views.common api/sideshow.web.views.customers api/sideshow.web.views.orders api/sideshow.web.views.products diff --git a/docs/narr/install.rst b/docs/narr/install.rst deleted file mode 100644 index 68ded40..0000000 --- a/docs/narr/install.rst +++ /dev/null @@ -1,70 +0,0 @@ - -============== - Installation -============== - - -Prerequisites -------------- - -You'll need Python >= 3.8, and a database. See also -:doc:`wuttjamaican:narr/install/prereqs` in the Wutta docs. - -.. code-block:: sh - - sudo apt install build-essential python3-dev python3-venv postgresql libpq-dev - -As for the database, see also :ref:`wuttjamaican:create-appdb` but FYI -these docs will assume a PostgreSQL setup with ``sideshow`` as the DB -name (and PG username). - -.. code-block:: sh - - sudo -u postgres createuser sideshow - sudo -u postgres psql -c "ALTER USER sideshow PASSWORD 'mypassword'" - sudo -u postgres createdb -O sideshow sideshow - - -Virtual Environment -------------------- - -You should use a separate Python virtual environment for Sideshow. -See also :doc:`wuttjamaican:narr/install/venv` but these docs will -assume this exists at ``/srv/envs/sideshow``. - -Note that root privileges are required to create the folder, but then -the folder ownership should be changed to whatever you need: - -.. code-block:: sh - - cd /srv/envs - sudo mkdir -p sideshow - sudo chown myname:myname sideshow - - python3 -m venv /srv/envs/sideshow - cd /srv/envs/sideshow - source bin/activate - - -Install Sideshow ----------------- - -First install the Sideshow package to your virtual environment: - -.. code-block:: sh - - cd /srv/envs/sideshow - bin/pip install Sideshow - -Then you can run the Sideshow installer: - -.. code-block:: sh - - bin/sideshow install - -That will prompt you for DB connection info etc. When finished you -can run Sideshow: - -.. code-block:: sh - - bin/wutta -c app/web.conf webapp diff --git a/src/sideshow/web/views/__init__.py b/src/sideshow/web/views/__init__.py index 13a468c..efcf397 100644 --- a/src/sideshow/web/views/__init__.py +++ b/src/sideshow/web/views/__init__.py @@ -2,7 +2,7 @@ ################################################################################ # # Sideshow -- Case/Special Order Tracker -# Copyright © 2024-2025 Lance Edgar +# Copyright © 2024 Lance Edgar # # This file is part of Sideshow. # @@ -24,15 +24,11 @@ Sideshow Views """ -from wuttaweb.views import essential - def includeme(config): # core views for wuttaweb - essential.defaults(config, **{ - 'wuttaweb.views.common': 'sideshow.web.views.common', - }) + config.include('wuttaweb.views.essential') # sideshow views config.include('sideshow.web.views.customers') diff --git a/src/sideshow/web/views/common.py b/src/sideshow/web/views/common.py deleted file mode 100644 index 8e19ef7..0000000 --- a/src/sideshow/web/views/common.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8; -*- -################################################################################ -# -# Sideshow -- Case/Special Order Tracker -# Copyright © 2024-2025 Lance Edgar -# -# This file is part of Sideshow. -# -# Sideshow 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. -# -# Sideshow 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 Sideshow. If not, see . -# -################################################################################ -""" -Common Views -""" - -from wuttaweb.views import common as base - - -class CommonView(base.CommonView): - """ - Sideshow overrides for common view logic. - """ - - def setup_enhance_admin_user(self, user): - """ - Adds the "Order Admin" role with all relevant permissions. - - The default logic for creating a new user will create the - "Site Admin" role with permissions for app and user account - maintenance etc. Sideshow needs another role for the order - maintenance. - """ - model = self.app.model - session = self.app.get_session(user) - auth = self.app.get_auth_handler() - - admin = model.Role(name="Order Admin") - admin.notes = ("this role was auto-created; " - "you can change or remove it as needed.") - - session.add(admin) - user.roles.append(admin) - - order_admin_perms = [ - 'local_customers.list', - 'local_customers.view', - 'local_products.list', - 'local_products.view', - 'neworder_batches.list', - 'neworder_batches.view', - 'order_items.add_note', - 'order_items.change_status', - 'order_items.list', - 'order_items.view', - 'order_items_contact.add_note', - 'order_items_contact.change_status', - 'order_items_contact.list', - 'order_items_contact.process_contact', - 'order_items_contact.view', - 'order_items_delivery.add_note', - 'order_items_delivery.change_status', - 'order_items_delivery.list', - 'order_items_delivery.process_delivery', - 'order_items_delivery.process_restock', - 'order_items_delivery.view', - 'order_items_placement.add_note', - 'order_items_placement.change_status', - 'order_items_placement.list', - 'order_items_placement.process_placement', - 'order_items_placement.view', - 'order_items_receiving.add_note', - 'order_items_receiving.change_status', - 'order_items_receiving.list', - 'order_items_receiving.process_receiving', - 'order_items_receiving.process_reorder', - 'order_items_receiving.view', - 'orders.configure', - 'orders.create', - 'orders.create_unknown_product', - 'orders.list', - 'orders.view', - 'pending_customers.list', - 'pending_customers.view', - 'pending_products.list', - 'pending_products.view', - ] - - for perm in order_admin_perms: - auth.grant_permission(admin, perm) - - -def includeme(config): - base.defaults(config, **{'CommonView': CommonView}) diff --git a/tests/web/views/test_common.py b/tests/web/views/test_common.py deleted file mode 100644 index f00a314..0000000 --- a/tests/web/views/test_common.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8; -*- - -from sideshow.testing import WebTestCase -from sideshow.web.views import common as mod - - -class TestIncludeme(WebTestCase): - - def test_coverage(self): - mod.includeme(self.pyramid_config) - - -class TestCommonView(WebTestCase): - - def make_view(self): - return mod.CommonView(self.request) - - def test_setup_enhance_admin_user(self): - model = self.app.model - view = self.make_view() - - user = model.User(username='barney') - self.session.add(user) - self.session.flush() - - self.assertEqual(len(user.roles), 0) - view.setup_enhance_admin_user(user) - self.assertEqual(len(user.roles), 1) - self.assertEqual(user.roles[0].name, 'Order Admin')