cherrypy-foundation 1.0.0a18__py3-none-any.whl → 1.0.0a20__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.
- cherrypy_foundation/flash.py +15 -13
- cherrypy_foundation/tests/test_form.py +1 -1
- cherrypy_foundation/tools/ratelimit.py +1 -1
- {cherrypy_foundation-1.0.0a18.dist-info → cherrypy_foundation-1.0.0a20.dist-info}/METADATA +1 -1
- {cherrypy_foundation-1.0.0a18.dist-info → cherrypy_foundation-1.0.0a20.dist-info}/RECORD +8 -8
- {cherrypy_foundation-1.0.0a18.dist-info → cherrypy_foundation-1.0.0a20.dist-info}/WHEEL +0 -0
- {cherrypy_foundation-1.0.0a18.dist-info → cherrypy_foundation-1.0.0a20.dist-info}/licenses/LICENSE.md +0 -0
- {cherrypy_foundation-1.0.0a18.dist-info → cherrypy_foundation-1.0.0a20.dist-info}/top_level.txt +0 -0
cherrypy_foundation/flash.py
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
from collections import namedtuple
|
|
18
18
|
|
|
19
|
-
import
|
|
19
|
+
from cherrypy_foundation.sessions import session_lock
|
|
20
20
|
|
|
21
21
|
FlashMessage = namedtuple('FlashMessage', ['message', 'level'])
|
|
22
22
|
|
|
@@ -27,22 +27,24 @@ def flash(message, level='info'):
|
|
|
27
27
|
"""
|
|
28
28
|
assert message
|
|
29
29
|
assert level in ['info', 'error', 'warning', 'success']
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
with session_lock() as session:
|
|
31
|
+
if 'flash' not in session:
|
|
32
|
+
session['flash'] = []
|
|
33
|
+
# Support Markup and string
|
|
34
|
+
if hasattr(message, '__html__'):
|
|
35
|
+
flash_message = FlashMessage(message, level)
|
|
36
|
+
else:
|
|
37
|
+
flash_message = FlashMessage(str(message), level)
|
|
38
|
+
session['flash'].append(flash_message)
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
def get_flashed_messages():
|
|
41
42
|
"""
|
|
42
43
|
Return all flash message.
|
|
43
44
|
"""
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
with session_lock() as session:
|
|
46
|
+
if 'flash' in session:
|
|
47
|
+
messages = session['flash']
|
|
48
|
+
del session['flash']
|
|
49
|
+
return messages
|
|
48
50
|
return []
|
|
@@ -198,7 +198,7 @@ class Ratelimit(cherrypy.Tool):
|
|
|
198
198
|
if delay <= 0:
|
|
199
199
|
raise ValueError('Invalid delay: %s' % delay)
|
|
200
200
|
if limit <= 0:
|
|
201
|
-
|
|
201
|
+
return
|
|
202
202
|
|
|
203
203
|
# Check if this 'method' should be rate limited
|
|
204
204
|
request = cherrypy.request
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
cherrypy_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
cherrypy_foundation/error_page.py,sha256=GEg_KZGRE63ZsTTtmrEpE9GsYcm6shZvp5KLR53sIMA,3248
|
|
3
|
-
cherrypy_foundation/flash.py,sha256=
|
|
3
|
+
cherrypy_foundation/flash.py,sha256=vraKvmYmjdV1cGsPSxTLVsekwqOnoyiVPqKjv6UW5OU,1646
|
|
4
4
|
cherrypy_foundation/form.py,sha256=8zp72fpYrmMGsIK5LxVY7sL_qqhoMDnIQoMND1s6CXk,3994
|
|
5
5
|
cherrypy_foundation/logging.py,sha256=JyzcuAu3HWzvMTSFBuKpwgnJLz1lRlx-j6EkuTwlb6I,3463
|
|
6
6
|
cherrypy_foundation/passwd.py,sha256=iyz3SgcvpgxsZgPUoTEXiqdKtwOANPrRKYhVPm2d_NQ,2139
|
|
@@ -97,7 +97,7 @@ cherrypy_foundation/plugins/tests/test_smtp.py,sha256=LYUXjDe8TtyruBSm18N73nSxHi
|
|
|
97
97
|
cherrypy_foundation/tests/__init__.py,sha256=bbdyalzM2mwBbId-7JBPXYuRzk7oUBCncq33ypD9v3Y,2818
|
|
98
98
|
cherrypy_foundation/tests/test_error_page.py,sha256=EmsCXYkFFMReNSORZYCo7qKvL2x98QgtKIlv1nFKIUU,2399
|
|
99
99
|
cherrypy_foundation/tests/test_flash.py,sha256=NNbT3XI1dHk0hXqJsWndCmPPohK9ig87ZYJaRNPJxR8,1994
|
|
100
|
-
cherrypy_foundation/tests/test_form.py,sha256
|
|
100
|
+
cherrypy_foundation/tests/test_form.py,sha256=-2h38e00hWlYNJeVWrUB2V11UZ3x0FmTcsCez5vWoas,5542
|
|
101
101
|
cherrypy_foundation/tests/test_logging.py,sha256=Lg1yGwFHTSpGbPvNXBi9risypZziJlAOMi1DeennxRs,2623
|
|
102
102
|
cherrypy_foundation/tests/test_passwd.py,sha256=nGqJZYwRPziifLvf5rm3YifxAvIOFdU_6LkHaUvRk8w,1951
|
|
103
103
|
cherrypy_foundation/tests/test_url.py,sha256=sSNwK7KZJcrLtnf_XROYQAPQoYNO5lAsa2BjhFjgmws,6434
|
|
@@ -109,7 +109,7 @@ cherrypy_foundation/tools/auth.py,sha256=WRXiZdRXJcd4uZFDb8DAGX-ySqiYytdWyjiQiLZ
|
|
|
109
109
|
cherrypy_foundation/tools/auth_mfa.py,sha256=hDwfKc2zFY3bxOm1JRLLFQRXVPL9atBQ-PEwQTEQUww,9579
|
|
110
110
|
cherrypy_foundation/tools/i18n.py,sha256=f4m9fc2FKtcdUpXgnLXzhoipn4oLDuHY94Vv3KPSfp0,17126
|
|
111
111
|
cherrypy_foundation/tools/jinja2.py,sha256=hTiOepdb7kyDEqCK4NH2O-v1lrgPGNX4VV3AWZ-OsAc,5967
|
|
112
|
-
cherrypy_foundation/tools/ratelimit.py,sha256=
|
|
112
|
+
cherrypy_foundation/tools/ratelimit.py,sha256=C_bGzkx9waIJlpK-X6_SH8r1rP0I_xr0wLnGZhSEGEo,8742
|
|
113
113
|
cherrypy_foundation/tools/secure_headers.py,sha256=XqmjU5MCK8fTacQ2uTUiODYN4uaa9cCGfQJZVnp4J4g,3921
|
|
114
114
|
cherrypy_foundation/tools/sessions_timeout.py,sha256=M54IpRc3c4rUH0Cbri363O6GhD89EmzrjqvWeul8khc,7484
|
|
115
115
|
cherrypy_foundation/tools/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -128,8 +128,8 @@ cherrypy_foundation/tools/tests/locales/fr/LC_MESSAGES/messages.po,sha256=6_Sk9I
|
|
|
128
128
|
cherrypy_foundation/tools/tests/templates/test_jinja2.html,sha256=s1bHmy-lyf0YW0t-LOx3ugILV2kqFoBNYxziWgrZbo0,216
|
|
129
129
|
cherrypy_foundation/tools/tests/templates/test_jinjax.html,sha256=NImzIW0mUHxilFd61PSoxFC-yu1nayEVwv-5zlgD9yo,179
|
|
130
130
|
cherrypy_foundation/tools/tests/templates/test_jinjax_i18n.html,sha256=yre8j7HBjpTQZHpM0PuB3ASGD3O4vKkJ-y72Fm6STgY,771
|
|
131
|
-
cherrypy_foundation-1.0.
|
|
132
|
-
cherrypy_foundation-1.0.
|
|
133
|
-
cherrypy_foundation-1.0.
|
|
134
|
-
cherrypy_foundation-1.0.
|
|
135
|
-
cherrypy_foundation-1.0.
|
|
131
|
+
cherrypy_foundation-1.0.0a20.dist-info/licenses/LICENSE.md,sha256=trSLYs5qlaow_bBwsLTRKpmTXsXzFksM_YUCMqrgAJQ,35149
|
|
132
|
+
cherrypy_foundation-1.0.0a20.dist-info/METADATA,sha256=5aY_cGJ0ziWu_GUyinwsYjM2oPEWsgCpkJS01kaOsjg,3551
|
|
133
|
+
cherrypy_foundation-1.0.0a20.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
134
|
+
cherrypy_foundation-1.0.0a20.dist-info/top_level.txt,sha256=B1vQPTLYhpKJ6W0JkRCWyAf8RPcnwJWdYxixv75-4ew,20
|
|
135
|
+
cherrypy_foundation-1.0.0a20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{cherrypy_foundation-1.0.0a18.dist-info → cherrypy_foundation-1.0.0a20.dist-info}/top_level.txt
RENAMED
|
File without changes
|