Coverage for src/sideshow/app.py: 100%
7 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-02-21 18:04 -0600
« prev ^ index » next coverage.py v7.6.12, created at 2025-02-21 18:04 -0600
1# -*- coding: utf-8; -*-
2################################################################################
3#
4# Sideshow -- Case/Special Order Tracker
5# Copyright © 2024 Lance Edgar
6#
7# This file is part of Sideshow.
8#
9# Sideshow is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# Sideshow is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17# General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with Sideshow. If not, see <http://www.gnu.org/licenses/>.
21#
22################################################################################
23"""
24Sideshow app provider
25"""
27from wuttjamaican import app as base
30class SideshowAppProvider(base.AppProvider):
31 """
32 The :term:`app provider` for Sideshow.
34 This adds the :meth:`get_order_handler()` method to the :term:`app
35 handler`.
36 """
38 def get_order_handler(self, **kwargs):
39 """
40 Get the configured :term:`order handler` for the app.
42 You can specify a custom handler in your :term:`config file`
43 like:
45 .. code-block:: ini
47 [sideshow]
48 orders.handler_spec = poser.orders:PoserOrderHandler
50 :returns: Instance of :class:`~sideshow.orders.OrderHandler`.
51 """
52 if 'order_handler' not in self.__dict__:
53 spec = self.config.get('sideshow.orders.handler_spec',
54 default='sideshow.orders:OrderHandler')
55 self.order_handler = self.app.load_object(spec)(self.config)
56 return self.order_handler