Coverage for .tox/coverage/lib/python3.11/site-packages/wuttaweb/static/__init__.py: 100%
7 statements
« prev ^ index » next coverage.py v7.6.10, created at 2024-12-28 21:19 -0600
« prev ^ index » next coverage.py v7.6.10, created at 2024-12-28 21:19 -0600
1# -*- coding: utf-8; -*-
2################################################################################
3#
4# wuttaweb -- Web App for Wutta Framework
5# Copyright © 2024 Lance Edgar
6#
7# This file is part of Wutta Framework.
8#
9# Wutta Framework is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by the Free
11# Software Foundation, either version 3 of the License, or (at your option) any
12# later version.
13#
14# Wutta Framework is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17# more details.
18#
19# You should have received a copy of the GNU General Public License along with
20# Wutta Framework. If not, see <http://www.gnu.org/licenses/>.
21#
22################################################################################
23"""
24Static Assets
26Note that (for now?) It is assumed that *all* (i.e. even custom) apps
27will include this module somewhere during startup. For instance this
28happens within :func:`wuttaweb.app.main()`::
30 pyramid_config.include('wuttaweb.static')
32This allows for certain common assets to be available for all apps.
34However, an attempt is being made to incorporate Fanstatic for use
35with the built-in static assets. It is possible the above mechanism
36could be abandoned in the future.
38So on the Fanstatic front, we currently have defined:
40.. data:: img
42 A :class:`fanstatic:fanstatic.Library` representing the ``img``
43 static folder.
45.. data:: favicon
47 A :class:`fanstatic:fanstatic.Resource` representing the
48 ``img/favicon.ico`` image file.
50.. data:: logo
52 A :class:`fanstatic:fanstatic.Resource` representing the
53 ``img/logo.png`` image file.
55.. data:: testing
57 A :class:`fanstatic:fanstatic.Resource` representing the
58 ``img/testing.png`` image file.
59"""
61from fanstatic import Library, Resource
64# fanstatic img library
65img = Library('wuttaweb_img', 'img')
66favicon = Resource(img, 'favicon.ico')
67# nb. mock out the renderers here, to appease fanstatic
68logo = Resource(img, 'logo.png', renderer=True)
69testing = Resource(img, 'testing.png', renderer=True)
72# TODO: should consider deprecating this?
73def includeme(config):
74 config.add_static_view('wuttaweb', 'wuttaweb:static')