Coverage for .tox / coverage / lib / python3.11 / site-packages / wuttaweb / views / essential.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2025-12-31 19:25 -0600

1# -*- coding: utf-8; -*- 

2################################################################################ 

3# 

4# wuttaweb -- Web App for Wutta Framework 

5# Copyright © 2024-2025 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""" 

24Essential views for convenient includes 

25 

26Most apps should include this module:: 

27 

28 pyramid_config.include("wuttaweb.views.essential") 

29 

30That will in turn include the following modules: 

31 

32* :mod:`wuttaweb.views.common` 

33* :mod:`wuttaweb.views.auth` 

34* :mod:`wuttaweb.views.email` 

35* :mod:`wuttaweb.views.settings` 

36* :mod:`wuttaweb.views.progress` 

37* :mod:`wuttaweb.views.people` 

38* :mod:`wuttaweb.views.roles` 

39* :mod:`wuttaweb.views.users` 

40* :mod:`wuttaweb.views.upgrades` 

41* :mod:`wuttaweb.views.tables` 

42* :mod:`wuttaweb.views.alembic` 

43* :mod:`wuttaweb.views.views` 

44 

45You can also selectively override some modules while keeping most 

46defaults. 

47 

48That uses a slightly different approach. First here is how to do it 

49while keeping all defaults:: 

50 

51 from wuttaweb.views import essential 

52 

53 essential.defaults(pyramid_config) 

54 

55To override, specify the default module with your preferred alias like 

56so:: 

57 

58 essential.defaults(pyramid_config, **{ 

59 "wuttaweb.views.users": "poser.web.views.users", 

60 "wuttaweb.views.upgrades": "poser.web.views.upgrades", 

61 }) 

62""" 

63 

64 

65def defaults(config, **kwargs): # pylint: disable=missing-function-docstring 

66 

67 def mod(spec): 

68 return kwargs.get(spec, spec) 

69 

70 config.include(mod("wuttaweb.views.common")) 

71 config.include(mod("wuttaweb.views.auth")) 

72 config.include(mod("wuttaweb.views.email")) 

73 config.include(mod("wuttaweb.views.settings")) 

74 config.include(mod("wuttaweb.views.progress")) 

75 config.include(mod("wuttaweb.views.people")) 

76 config.include(mod("wuttaweb.views.roles")) 

77 config.include(mod("wuttaweb.views.users")) 

78 config.include(mod("wuttaweb.views.upgrades")) 

79 config.include(mod("wuttaweb.views.tables")) 

80 config.include(mod("wuttaweb.views.alembic")) 

81 config.include(mod("wuttaweb.views.views")) 

82 

83 

84def includeme(config): # pylint: disable=missing-function-docstring 

85 defaults(config)