cherrypy-foundation 1.0.0a19__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.
@@ -16,7 +16,7 @@
16
16
 
17
17
  from collections import namedtuple
18
18
 
19
- import cherrypy
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
- if 'flash' not in cherrypy.session:
31
- cherrypy.session['flash'] = []
32
- # Support Markup and string
33
- if hasattr(message, '__html__'):
34
- flash_message = FlashMessage(message, level)
35
- else:
36
- flash_message = FlashMessage(str(message), level)
37
- cherrypy.session['flash'].append(flash_message)
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
- if 'flash' in cherrypy.session:
45
- messages = cherrypy.session['flash']
46
- del cherrypy.session['flash']
47
- return messages
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 []
@@ -69,7 +69,7 @@ class LoginForm(CherryForm):
69
69
  )
70
70
 
71
71
 
72
- @cherrypy.tools.sessions(locking='explicit')
72
+ @cherrypy.tools.sessions()
73
73
  @cherrypy.tools.jinja2(env=env)
74
74
  class Root:
75
75
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cherrypy-foundation
3
- Version: 1.0.0a19
3
+ Version: 1.0.0a20
4
4
  Summary: Cherrypy-foundation
5
5
  Author-email: Patrik Dufresne <patrik@ikus-soft.com>
6
6
  License: GPLv3
@@ -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=qCghKgVgtjbQVrm6xyIIfRKzf03njFHh6b4tnawzkUM,1542
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=wfmKcWTEOPi6BOAUy9oDfkX7LJf9DfxtNRER8R3Ma2g,5560
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
@@ -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.0a19.dist-info/licenses/LICENSE.md,sha256=trSLYs5qlaow_bBwsLTRKpmTXsXzFksM_YUCMqrgAJQ,35149
132
- cherrypy_foundation-1.0.0a19.dist-info/METADATA,sha256=etkiHbuCu6NKyrzniIbKIfhxMKdwIVfr6A3XGHy6yyo,3551
133
- cherrypy_foundation-1.0.0a19.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
134
- cherrypy_foundation-1.0.0a19.dist-info/top_level.txt,sha256=B1vQPTLYhpKJ6W0JkRCWyAf8RPcnwJWdYxixv75-4ew,20
135
- cherrypy_foundation-1.0.0a19.dist-info/RECORD,,
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,,