cherrypy-foundation 1.0.0a6__py3-none-any.whl → 1.0.0a7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ {# def messages, floating=False #}
2
+ <div {{ attrs.render(class="flash-messages") }}>
3
+ {% for message, level in messages %}
4
+ <div class="alert alert-{{'danger' if level == 'error' else level }} alert-dismissible fade show"
5
+ role="alert">
6
+ {{ message }}
7
+ <button type="button"
8
+ class="btn-close"
9
+ data-bs-dismiss="alert"
10
+ aria-label="Close"></button>
11
+ </div>
12
+ {% endfor %}
13
+ </div>
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <title>test-flash</title>
4
+ </head>
5
+ <body>
6
+ <Flash messages={{ get_flashed_messages() }} class="mb-2" style="min-height:100px"/>
7
+ </body>
8
+ </html>
@@ -0,0 +1,62 @@
1
+ # CherryPy Foundation
2
+ # Copyright (C) 2025 IKUS Software
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ import importlib
17
+ from unittest import skipUnless
18
+
19
+ import cherrypy
20
+ from cherrypy.test import helper
21
+
22
+ import cherrypy_foundation.tools.jinja2 # noqa
23
+ from cherrypy_foundation.flash import flash, get_flashed_messages
24
+
25
+ HAS_JINJAX = importlib.util.find_spec("jinjax") is not None
26
+
27
+ env = cherrypy.tools.jinja2.create_env(
28
+ package_name=__package__,
29
+ globals={'get_flashed_messages': get_flashed_messages},
30
+ )
31
+
32
+
33
+ @cherrypy.tools.sessions()
34
+ @cherrypy.tools.jinja2(env=env)
35
+ class Root:
36
+
37
+ @cherrypy.expose
38
+ @cherrypy.tools.jinja2(template='test_flash.html')
39
+ def index(self):
40
+ flash('default flash message', level='info')
41
+ return {}
42
+
43
+
44
+ @skipUnless(HAS_JINJAX, reason='Required jinjax')
45
+ class FormTest(helper.CPWebCase):
46
+ default_lang = None
47
+ interactive = False
48
+
49
+ @classmethod
50
+ def setup_server(cls):
51
+ cherrypy.tree.mount(Root(), '/')
52
+
53
+ def test_get_flash(self):
54
+ # Given a page returning a flash message
55
+ # When querying the page that include this form
56
+ self.getPage("/")
57
+ self.assertStatus(200)
58
+ # Then page display the message.
59
+ self.assertInBody('test-flash')
60
+ self.assertInBody('<div class="mb-2 flash-messages" style="min-height:100px">')
61
+ self.assertInBody('<div class="alert alert-info alert-dismissible fade show"')
62
+ self.assertInBody('default flash message')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cherrypy-foundation
3
- Version: 1.0.0a6
3
+ Version: 1.0.0a7
4
4
  Summary: CherryPy Foundation
5
5
  Author-email: Patrik Dufresne <patrik@ikus-soft.com>
6
6
  License: GPLv3
@@ -14,6 +14,7 @@ cherrypy_foundation/components/Field.css,sha256=CtOkvIbix7ykrOKLJxQJLJsWfEwFqfdu
14
14
  cherrypy_foundation/components/Field.jinja,sha256=R-ZUm88XXOb3zi_hysTuwFUCGGR67A59P4TT5d1Qo_o,3152
15
15
  cherrypy_foundation/components/Field.js,sha256=SFixZ62WlLq7SSCEazMAGhSnc9EnQ1wg6PZX4ayO6ZE,2047
16
16
  cherrypy_foundation/components/Fields.jinja,sha256=UDu1txwMguvr7dyga9PXepEhFvz9C6ZvchBnhQCWgHI,318
17
+ cherrypy_foundation/components/Flash.jinja,sha256=COy44drQsXpbZajjJS4w_9NMPYFdMfUNdfhd7SbFdYA,442
17
18
  cherrypy_foundation/components/Icon.jinja,sha256=Z1RGYBg5xlDEoUy3glqb_k_LEjkJHeCxQXqDEvWzEF4,135
18
19
  cherrypy_foundation/components/SideBySideMultiSelect.css,sha256=_poMY9O8rvDsOh01pQLf9qtg1Gm4eCM2HsM_ekC5zkk,503
19
20
  cherrypy_foundation/components/SideBySideMultiSelect.jinja,sha256=sud1WP-6JzuP7ZLRr-JQqvgMRWZRlXvxUJfguFr_klk,478
@@ -91,9 +92,11 @@ cherrypy_foundation/plugins/tests/test_scheduler.py,sha256=I-ZuQhMvCCvqFDwukwsyz
91
92
  cherrypy_foundation/plugins/tests/test_smtp.py,sha256=qs5yezIpSXkBmLmFlqckfPW7NmntHZxQjDSkdQG_dNE,4183
92
93
  cherrypy_foundation/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
94
  cherrypy_foundation/tests/test_error_page.py,sha256=8u5p6lv_I4XvfGipjJXNFwW7G1N8AK8IOnc_Th-Ebto,2181
95
+ cherrypy_foundation/tests/test_flash.py,sha256=OMoEKy4xaYT75OZ4bdL3Vb3jDRBNP_Wr3BaVAlkO9V4,2064
94
96
  cherrypy_foundation/tests/test_form.py,sha256=KvVA7OEqaDR-A-1EJdA-WlXkqyK9YJkRHhoUvGx1zr8,4269
95
97
  cherrypy_foundation/tests/test_passwd.py,sha256=gC5O4yhHyU1YRYuDc0pG0T_5zvrG2qrr6P822iyK3Rg,1956
96
98
  cherrypy_foundation/tests/test_url.py,sha256=W-RTKQuxYS2KXxCYTTtnKcxfdP9F6Fp3QKY_sBTnBmE,6434
99
+ cherrypy_foundation/tests/templates/test_flash.html,sha256=MyOPsHQX97TB30sbKrbG3tagKDyvV8OVKp-UOrw7REc,187
97
100
  cherrypy_foundation/tests/templates/test_form.html,sha256=sm-n2cYvih2vbDE4Y8kkERSoulnKAbwoefbzBggMMnA,189
98
101
  cherrypy_foundation/tests/templates/test_url.html,sha256=Rb6NokHEduMHAXO8P6EduMMHXuNzJGN5Of2OF4fSWns,502
99
102
  cherrypy_foundation/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -120,8 +123,8 @@ cherrypy_foundation/tools/tests/locales/fr/LC_MESSAGES/messages.po,sha256=6_Sk9I
120
123
  cherrypy_foundation/tools/tests/templates/test_jinja2.html,sha256=v9AHxksbBvzE7sesPqE61HMhsvU4juXt3E0ZQo-zXVQ,190
121
124
  cherrypy_foundation/tools/tests/templates/test_jinja2_i18n.html,sha256=98S51dgG7Vb4rvMZNZvomw1D9pBiM4g6pdlxAgvrxXA,373
122
125
  cherrypy_foundation/tools/tests/templates/test_jinjax.html,sha256=NT19UaUzm8FRKOIc6H6HNGPDJU6KATnakd8zf3BCeAs,153
123
- cherrypy_foundation-1.0.0a6.dist-info/licenses/LICENSE.md,sha256=trSLYs5qlaow_bBwsLTRKpmTXsXzFksM_YUCMqrgAJQ,35149
124
- cherrypy_foundation-1.0.0a6.dist-info/METADATA,sha256=xHtefK1X2ayzdEuYQ38AYfgN2hJYkvvgsVDFp2qA7i0,2022
125
- cherrypy_foundation-1.0.0a6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
- cherrypy_foundation-1.0.0a6.dist-info/top_level.txt,sha256=B1vQPTLYhpKJ6W0JkRCWyAf8RPcnwJWdYxixv75-4ew,20
127
- cherrypy_foundation-1.0.0a6.dist-info/RECORD,,
126
+ cherrypy_foundation-1.0.0a7.dist-info/licenses/LICENSE.md,sha256=trSLYs5qlaow_bBwsLTRKpmTXsXzFksM_YUCMqrgAJQ,35149
127
+ cherrypy_foundation-1.0.0a7.dist-info/METADATA,sha256=ijef0IFNw9vsQRxuexXc07h4_OWHPgIIQSmj5FQDY-w,2022
128
+ cherrypy_foundation-1.0.0a7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
129
+ cherrypy_foundation-1.0.0a7.dist-info/top_level.txt,sha256=B1vQPTLYhpKJ6W0JkRCWyAf8RPcnwJWdYxixv75-4ew,20
130
+ cherrypy_foundation-1.0.0a7.dist-info/RECORD,,