z3c.flashmessage 2.1__tar.gz → 3.1__tar.gz
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.
- z3c_flashmessage-3.1/.pre-commit-config.yaml +28 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/CHANGES.rst +18 -0
- z3c_flashmessage-3.1/CONTRIBUTING.md +23 -0
- z3c_flashmessage-3.1/MANIFEST.in +13 -0
- z3c_flashmessage-3.1/PKG-INFO +262 -0
- z3c_flashmessage-3.1/pyproject.toml +32 -0
- z3c_flashmessage-3.1/setup.cfg +23 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/setup.py +13 -10
- z3c_flashmessage-3.1/src/z3c/__init__.py +1 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/interfaces.py +4 -5
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/message.py +3 -3
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/receiver.py +1 -2
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/sources.py +4 -8
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/tests.py +3 -2
- z3c_flashmessage-3.1/src/z3c.flashmessage.egg-info/PKG-INFO +262 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c.flashmessage.egg-info/SOURCES.txt +3 -4
- z3c_flashmessage-3.1/tox.ini +73 -0
- z3c.flashmessage-2.1/.coveragerc +0 -15
- z3c.flashmessage-2.1/.gitignore +0 -16
- z3c.flashmessage-2.1/.travis.yml +0 -25
- z3c.flashmessage-2.1/MANIFEST.in +0 -9
- z3c.flashmessage-2.1/PKG-INFO +0 -222
- z3c.flashmessage-2.1/bootstrap.py +0 -189
- z3c.flashmessage-2.1/setup.cfg +0 -7
- z3c.flashmessage-2.1/src/z3c/__init__.py +0 -1
- z3c.flashmessage-2.1/src/z3c.flashmessage.egg-info/PKG-INFO +0 -222
- z3c.flashmessage-2.1/tox.ini +0 -20
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/COPYRIGHT.txt +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/LICENSE.txt +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/README.rst +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/buildout.cfg +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/README.rst +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/TODO.txt +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/__init__.py +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/ftesting.zcml +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c/flashmessage/sketches.txt +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c.flashmessage.egg-info/dependency_links.txt +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c.flashmessage.egg-info/namespace_packages.txt +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c.flashmessage.egg-info/not-zip-safe +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c.flashmessage.egg-info/requires.txt +0 -0
- {z3c.flashmessage-2.1 → z3c_flashmessage-3.1}/src/z3c.flashmessage.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Generated from:
|
|
2
|
+
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
|
|
3
|
+
minimum_pre_commit_version: '3.6'
|
|
4
|
+
repos:
|
|
5
|
+
- repo: https://github.com/pycqa/isort
|
|
6
|
+
rev: "6.0.1"
|
|
7
|
+
hooks:
|
|
8
|
+
- id: isort
|
|
9
|
+
- repo: https://github.com/hhatto/autopep8
|
|
10
|
+
rev: "v2.3.2"
|
|
11
|
+
hooks:
|
|
12
|
+
- id: autopep8
|
|
13
|
+
args: [--in-place, --aggressive, --aggressive]
|
|
14
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
15
|
+
rev: v3.19.1
|
|
16
|
+
hooks:
|
|
17
|
+
- id: pyupgrade
|
|
18
|
+
args: [--py39-plus]
|
|
19
|
+
- repo: https://github.com/isidentical/teyit
|
|
20
|
+
rev: 0.4.3
|
|
21
|
+
hooks:
|
|
22
|
+
- id: teyit
|
|
23
|
+
- repo: https://github.com/PyCQA/flake8
|
|
24
|
+
rev: "7.1.2"
|
|
25
|
+
hooks:
|
|
26
|
+
- id: flake8
|
|
27
|
+
additional_dependencies:
|
|
28
|
+
- flake8-debugger == 4.1.2
|
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
CHANGES
|
|
3
3
|
=======
|
|
4
4
|
|
|
5
|
+
3.1 (2025-04-03)
|
|
6
|
+
================
|
|
7
|
+
|
|
8
|
+
- Add support for Python 3.12, 3.13.
|
|
9
|
+
|
|
10
|
+
- Drop support for Python 3.7, 3.8.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
3.0 (2023-02-08)
|
|
14
|
+
================
|
|
15
|
+
|
|
16
|
+
- Drop support for Python 2.7, 3.4, 3.5, 3.6.
|
|
17
|
+
|
|
18
|
+
- Add support for Python 3.8, 3.9, 3.10, 3.11.
|
|
19
|
+
|
|
20
|
+
- Ensure all objects have consistent resolution orders.
|
|
21
|
+
|
|
22
|
+
|
|
5
23
|
2.1 (2018-11-12)
|
|
6
24
|
================
|
|
7
25
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Generated from:
|
|
3
|
+
https://github.com/zopefoundation/meta/tree/master/config/pure-python
|
|
4
|
+
-->
|
|
5
|
+
# Contributing to zopefoundation projects
|
|
6
|
+
|
|
7
|
+
The projects under the zopefoundation GitHub organization are open source and
|
|
8
|
+
welcome contributions in different forms:
|
|
9
|
+
|
|
10
|
+
* bug reports
|
|
11
|
+
* code improvements and bug fixes
|
|
12
|
+
* documentation improvements
|
|
13
|
+
* pull request reviews
|
|
14
|
+
|
|
15
|
+
For any changes in the repository besides trivial typo fixes you are required
|
|
16
|
+
to sign the contributor agreement. See
|
|
17
|
+
https://www.zope.dev/developer/becoming-a-committer.html for details.
|
|
18
|
+
|
|
19
|
+
Please visit our [Developer
|
|
20
|
+
Guidelines](https://www.zope.dev/developer/guidelines.html) if you'd like to
|
|
21
|
+
contribute code changes and our [guidelines for reporting
|
|
22
|
+
bugs](https://www.zope.dev/developer/reporting-bugs.html) if you want to file a
|
|
23
|
+
bug report.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Generated from:
|
|
2
|
+
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
|
|
3
|
+
include *.md
|
|
4
|
+
include *.rst
|
|
5
|
+
include *.txt
|
|
6
|
+
include buildout.cfg
|
|
7
|
+
include tox.ini
|
|
8
|
+
include .pre-commit-config.yaml
|
|
9
|
+
|
|
10
|
+
recursive-include src *.py
|
|
11
|
+
recursive-include src *.rst
|
|
12
|
+
recursive-include src *.txt
|
|
13
|
+
recursive-include src *.zcml
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: z3c.flashmessage
|
|
3
|
+
Version: 3.1
|
|
4
|
+
Summary: A package for sending `flash messages` to users.
|
|
5
|
+
Home-page: https://github.com/zopefoundation/z3c.flashmessage
|
|
6
|
+
Author: Jasper Op de Coul, Christian Theune
|
|
7
|
+
Author-email: jasper@infrae.com, mail@gocept.com
|
|
8
|
+
License: ZPL-2.1
|
|
9
|
+
Keywords: zope3 message zope session
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Zope Public License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
21
|
+
Classifier: Natural Language :: English
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
24
|
+
Classifier: Framework :: Zope :: 3
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
License-File: LICENSE.txt
|
|
27
|
+
Requires-Dist: setuptools
|
|
28
|
+
Requires-Dist: ZODB
|
|
29
|
+
Requires-Dist: zope.interface
|
|
30
|
+
Requires-Dist: zope.schema
|
|
31
|
+
Requires-Dist: zope.session
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: zope.publisher; extra == "test"
|
|
34
|
+
Requires-Dist: zope.component; extra == "test"
|
|
35
|
+
Requires-Dist: zope.security; extra == "test"
|
|
36
|
+
Requires-Dist: zope.testrunner; extra == "test"
|
|
37
|
+
Requires-Dist: zope.app.wsgi[testlayer]>=4.0; extra == "test"
|
|
38
|
+
Requires-Dist: Webtest; extra == "test"
|
|
39
|
+
Dynamic: author
|
|
40
|
+
Dynamic: author-email
|
|
41
|
+
Dynamic: classifier
|
|
42
|
+
Dynamic: description
|
|
43
|
+
Dynamic: home-page
|
|
44
|
+
Dynamic: keywords
|
|
45
|
+
Dynamic: license
|
|
46
|
+
Dynamic: provides-extra
|
|
47
|
+
Dynamic: requires-dist
|
|
48
|
+
Dynamic: requires-python
|
|
49
|
+
Dynamic: summary
|
|
50
|
+
|
|
51
|
+
.. contents::
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
==============
|
|
56
|
+
Flash messages
|
|
57
|
+
==============
|
|
58
|
+
|
|
59
|
+
Components to display small messages to users.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Sending a message to the current user
|
|
63
|
+
=====================================
|
|
64
|
+
|
|
65
|
+
To send a message to the current user, you can use the session-based message
|
|
66
|
+
source. Let's set one up:
|
|
67
|
+
|
|
68
|
+
>>> from z3c.flashmessage.sources import SessionMessageSource
|
|
69
|
+
>>> from __future__ import unicode_literals
|
|
70
|
+
>>> source = SessionMessageSource()
|
|
71
|
+
|
|
72
|
+
>>> source.send('The world will come to an end in 40 seconds!')
|
|
73
|
+
|
|
74
|
+
The source allows to list all current messages:
|
|
75
|
+
|
|
76
|
+
>>> m = list(source.list())
|
|
77
|
+
>>> m
|
|
78
|
+
[<z3c.flashmessage.message.Message object at 0x...>]
|
|
79
|
+
>>> m[0].message
|
|
80
|
+
'The world will come to an end in 40 seconds!'
|
|
81
|
+
>>> str(m[0].type)
|
|
82
|
+
'message'
|
|
83
|
+
|
|
84
|
+
Receiving messages
|
|
85
|
+
==================
|
|
86
|
+
|
|
87
|
+
The standard message that is generated removes itself from the source when it
|
|
88
|
+
is received. The receiver will call `prepare()` on the message before it is
|
|
89
|
+
handed out to the code that receives it:
|
|
90
|
+
|
|
91
|
+
>>> m[0].prepare(source)
|
|
92
|
+
>>> list(source.list())
|
|
93
|
+
[]
|
|
94
|
+
|
|
95
|
+
There also is another default message that does not delete itself when being
|
|
96
|
+
read:
|
|
97
|
+
|
|
98
|
+
>>> from z3c.flashmessage.message import PersistentMessage
|
|
99
|
+
>>> source.send(PersistentMessage('I will stay forever!'))
|
|
100
|
+
>>> m = list(source.list())[0]
|
|
101
|
+
>>> m.message
|
|
102
|
+
'I will stay forever!'
|
|
103
|
+
>>> m.prepare(source)
|
|
104
|
+
>>> list(source.list())
|
|
105
|
+
[<z3c.flashmessage.message.PersistentMessage object at 0x...>]
|
|
106
|
+
|
|
107
|
+
Global receiver
|
|
108
|
+
===============
|
|
109
|
+
|
|
110
|
+
There is a global receiver that queries all message sources that are set up as
|
|
111
|
+
utilities. Let's set up a session message source as a utility:
|
|
112
|
+
|
|
113
|
+
>>> from zope.component import provideUtility
|
|
114
|
+
>>> provideUtility(source)
|
|
115
|
+
>>> source.send('Test!')
|
|
116
|
+
|
|
117
|
+
>>> from z3c.flashmessage.sources import RAMMessageSource
|
|
118
|
+
>>> source2 = RAMMessageSource()
|
|
119
|
+
>>> provideUtility(source2, name='other')
|
|
120
|
+
>>> source2.send('Test 2!')
|
|
121
|
+
>>> source2.send('Test 3!')
|
|
122
|
+
|
|
123
|
+
>>> from z3c.flashmessage.receiver import GlobalMessageReceiver
|
|
124
|
+
>>> receiver = GlobalMessageReceiver()
|
|
125
|
+
>>> m = list(receiver.receive())
|
|
126
|
+
>>> len(m)
|
|
127
|
+
4
|
|
128
|
+
>>> m[0].message
|
|
129
|
+
'I will stay forever!'
|
|
130
|
+
>>> m[1].message
|
|
131
|
+
'Test!'
|
|
132
|
+
>>> m[2].message
|
|
133
|
+
'Test 2!'
|
|
134
|
+
>>> m[3].message
|
|
135
|
+
'Test 3!'
|
|
136
|
+
|
|
137
|
+
After the receiver handed out the messages, they are gone from the
|
|
138
|
+
sources, because the receiver notifies the messages that they were
|
|
139
|
+
read:
|
|
140
|
+
|
|
141
|
+
>>> len(list(receiver.receive()))
|
|
142
|
+
1
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
Filtering message types
|
|
146
|
+
=======================
|
|
147
|
+
|
|
148
|
+
When listing messages from a message source, we can restrict which messages we
|
|
149
|
+
see. If we don't give a type, then all messages are returned. The default type
|
|
150
|
+
of a message is `message`:
|
|
151
|
+
|
|
152
|
+
>>> source3 = RAMMessageSource()
|
|
153
|
+
>>> source3.send('Test 2!')
|
|
154
|
+
>>> list(source3.list())
|
|
155
|
+
[<z3c.flashmessage.message.Message object at 0x...>]
|
|
156
|
+
>>> list(source3.list('message'))
|
|
157
|
+
[<z3c.flashmessage.message.Message object at 0x...>]
|
|
158
|
+
>>> list(source3.list('somethingelse'))
|
|
159
|
+
[]
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
Performance and Scalability Issues
|
|
163
|
+
==================================
|
|
164
|
+
|
|
165
|
+
By default, messages are stored persistently in the ZODB using
|
|
166
|
+
zope.session. This can be a significant scalability problem; see
|
|
167
|
+
design.txt in zope.session for more information. You should think
|
|
168
|
+
twice before using flashmessages for unauthenticated users, as this
|
|
169
|
+
can easily lead to unnecessary database growth on anonymous page
|
|
170
|
+
views, and conflict errors under heavy load.
|
|
171
|
+
|
|
172
|
+
One solution is to configure your system to store flashmessages in
|
|
173
|
+
RAM. You would do this by configuring a utility providing
|
|
174
|
+
``z3c.flashmessage.interfaces.IMessageSource`` with the factory set to
|
|
175
|
+
``z3c.flashmessage.sources.RAMMessageSource``, and a specific name if
|
|
176
|
+
your application expects one.
|
|
177
|
+
|
|
178
|
+
RAM storage is much faster and removes the persistence issues
|
|
179
|
+
described above, but there are two new problems. First, be aware that
|
|
180
|
+
if your server process restarts for any reason, all unread
|
|
181
|
+
flashmessages will be lost. Second, if you cluster your application
|
|
182
|
+
servers using e.g. ZEO, you must also ensure that your load-balancer
|
|
183
|
+
supports session affinity (so a specific client always hits the same
|
|
184
|
+
back end server). This somewhat reduces the performance benefits of
|
|
185
|
+
clustering.
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
=======
|
|
189
|
+
CHANGES
|
|
190
|
+
=======
|
|
191
|
+
|
|
192
|
+
3.1 (2025-04-03)
|
|
193
|
+
================
|
|
194
|
+
|
|
195
|
+
- Add support for Python 3.12, 3.13.
|
|
196
|
+
|
|
197
|
+
- Drop support for Python 3.7, 3.8.
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
3.0 (2023-02-08)
|
|
201
|
+
================
|
|
202
|
+
|
|
203
|
+
- Drop support for Python 2.7, 3.4, 3.5, 3.6.
|
|
204
|
+
|
|
205
|
+
- Add support for Python 3.8, 3.9, 3.10, 3.11.
|
|
206
|
+
|
|
207
|
+
- Ensure all objects have consistent resolution orders.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
2.1 (2018-11-12)
|
|
211
|
+
================
|
|
212
|
+
|
|
213
|
+
- Claim support for Python 3.6, 3.7, PyPy and PyPy3.
|
|
214
|
+
|
|
215
|
+
- Drop support for Python 3.3.
|
|
216
|
+
|
|
217
|
+
- Drop support for ``python setup.py test``.
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
2.0 (2016-08-08)
|
|
221
|
+
================
|
|
222
|
+
|
|
223
|
+
- Standardize namespace ``__init__``.
|
|
224
|
+
|
|
225
|
+
- Claim compatibility for Python 3.3, 3.4, and 3.5.
|
|
226
|
+
|
|
227
|
+
1.3 (2010-10-28)
|
|
228
|
+
================
|
|
229
|
+
|
|
230
|
+
- ``SessionMessageSource`` implicitly created sessions when the client was
|
|
231
|
+
reading the messages from the source. Changed internal API so reading no
|
|
232
|
+
longer creates a session when it not yet exists.
|
|
233
|
+
|
|
234
|
+
1.2 (2010-10-19)
|
|
235
|
+
================
|
|
236
|
+
|
|
237
|
+
* Removed test dependency on `zope.app.zcmlfiles`.
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
1.1 (2010-10-02)
|
|
241
|
+
================
|
|
242
|
+
|
|
243
|
+
* Removed test dependency on `zope.app.testing`.
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
1.0 (2007-12-06)
|
|
247
|
+
================
|
|
248
|
+
|
|
249
|
+
* Updated dependency to `zope.session` instead of `zope.app.session` to get
|
|
250
|
+
rid of deprecation warnings.
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
1.0b2 (2007-09-12)
|
|
254
|
+
==================
|
|
255
|
+
|
|
256
|
+
* Bugfix: When there was more than one message in a source not all messages
|
|
257
|
+
would be returned by the receiver.
|
|
258
|
+
|
|
259
|
+
1.0b1 (2007-08-22)
|
|
260
|
+
==================
|
|
261
|
+
|
|
262
|
+
* Initial public release.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Generated from:
|
|
2
|
+
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
|
|
3
|
+
|
|
4
|
+
[build-system]
|
|
5
|
+
requires = [
|
|
6
|
+
"setuptools == 75.8.2",
|
|
7
|
+
"wheel",
|
|
8
|
+
]
|
|
9
|
+
build-backend = "setuptools.build_meta"
|
|
10
|
+
|
|
11
|
+
[tool.coverage.run]
|
|
12
|
+
branch = true
|
|
13
|
+
source = ["z3c.flashmessage"]
|
|
14
|
+
|
|
15
|
+
[tool.coverage.report]
|
|
16
|
+
fail_under = 100
|
|
17
|
+
precision = 2
|
|
18
|
+
ignore_errors = true
|
|
19
|
+
show_missing = true
|
|
20
|
+
exclude_lines = [
|
|
21
|
+
"pragma: no cover",
|
|
22
|
+
"pragma: nocover",
|
|
23
|
+
"except ImportError:",
|
|
24
|
+
"raise NotImplementedError",
|
|
25
|
+
"if __name__ == '__main__':",
|
|
26
|
+
"self.fail",
|
|
27
|
+
"raise AssertionError",
|
|
28
|
+
"raise unittest.Skip",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[tool.coverage.html]
|
|
32
|
+
directory = "parts/htmlcov"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[flake8]
|
|
2
|
+
doctests = 1
|
|
3
|
+
|
|
4
|
+
[check-manifest]
|
|
5
|
+
ignore =
|
|
6
|
+
.editorconfig
|
|
7
|
+
.meta.toml
|
|
8
|
+
|
|
9
|
+
[isort]
|
|
10
|
+
force_single_line = True
|
|
11
|
+
combine_as_imports = True
|
|
12
|
+
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
|
|
13
|
+
known_third_party = docutils, pkg_resources, pytz
|
|
14
|
+
known_zope =
|
|
15
|
+
known_first_party =
|
|
16
|
+
default_section = ZOPE
|
|
17
|
+
line_length = 79
|
|
18
|
+
lines_after_imports = 2
|
|
19
|
+
|
|
20
|
+
[egg_info]
|
|
21
|
+
tag_build =
|
|
22
|
+
tag_date = 0
|
|
23
|
+
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import os.path
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
from setuptools import find_packages
|
|
4
|
+
from setuptools import setup
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
def read(*path_elements):
|
|
6
|
-
with open(os.path.join(*path_elements)
|
|
8
|
+
with open(os.path.join(*path_elements)) as f:
|
|
7
9
|
return "\n\n" + f.read()
|
|
8
10
|
|
|
11
|
+
|
|
9
12
|
TEST_REQUIREMENTS = [
|
|
10
13
|
'zope.publisher',
|
|
11
14
|
'zope.component',
|
|
@@ -17,7 +20,7 @@ TEST_REQUIREMENTS = [
|
|
|
17
20
|
|
|
18
21
|
setup(
|
|
19
22
|
name="z3c.flashmessage",
|
|
20
|
-
version='
|
|
23
|
+
version='3.1',
|
|
21
24
|
author="Jasper Op de Coul, Christian Theune",
|
|
22
25
|
author_email="jasper@infrae.com, mail@gocept.com",
|
|
23
26
|
description="A package for sending `flash messages` to users.",
|
|
@@ -27,19 +30,18 @@ setup(
|
|
|
27
30
|
read('CHANGES.rst')
|
|
28
31
|
),
|
|
29
32
|
url='https://github.com/zopefoundation/z3c.flashmessage',
|
|
30
|
-
license="ZPL
|
|
33
|
+
license="ZPL-2.1",
|
|
31
34
|
keywords="zope3 message zope session",
|
|
32
35
|
classifiers=[
|
|
33
36
|
'Environment :: Web Environment',
|
|
34
37
|
'Intended Audience :: Developers',
|
|
35
38
|
'License :: OSI Approved :: Zope Public License',
|
|
36
|
-
'Programming Language :: Python :: 2',
|
|
37
|
-
'Programming Language :: Python :: 2.7',
|
|
38
39
|
'Programming Language :: Python :: 3',
|
|
39
|
-
'Programming Language :: Python :: 3.
|
|
40
|
-
'Programming Language :: Python :: 3.
|
|
41
|
-
'Programming Language :: Python :: 3.
|
|
42
|
-
'Programming Language :: Python :: 3.
|
|
40
|
+
'Programming Language :: Python :: 3.9',
|
|
41
|
+
'Programming Language :: Python :: 3.10',
|
|
42
|
+
'Programming Language :: Python :: 3.11',
|
|
43
|
+
'Programming Language :: Python :: 3.12',
|
|
44
|
+
'Programming Language :: Python :: 3.13',
|
|
43
45
|
'Programming Language :: Python :: Implementation :: CPython',
|
|
44
46
|
'Programming Language :: Python :: Implementation :: PyPy',
|
|
45
47
|
'Natural Language :: English',
|
|
@@ -52,6 +54,7 @@ setup(
|
|
|
52
54
|
include_package_data=True,
|
|
53
55
|
package_dir={'': 'src'},
|
|
54
56
|
namespace_packages=['z3c'],
|
|
57
|
+
python_requires='>=3.9',
|
|
55
58
|
install_requires=[
|
|
56
59
|
'setuptools',
|
|
57
60
|
'ZODB',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- coding: latin-1 -*-
|
|
2
1
|
# Copyright (c) 2007 Zope Foundation and Contributors
|
|
3
2
|
# See also LICENSE.txt
|
|
4
3
|
# $Id$
|
|
@@ -11,10 +10,10 @@ import zope.schema
|
|
|
11
10
|
class IMessage(zope.interface.Interface):
|
|
12
11
|
"""A message that can be displayed to the user."""
|
|
13
12
|
|
|
14
|
-
message = zope.schema.TextLine(title=
|
|
13
|
+
message = zope.schema.TextLine(title="The message itself.")
|
|
15
14
|
|
|
16
|
-
type = zope.schema.TextLine(title=
|
|
17
|
-
default=
|
|
15
|
+
type = zope.schema.TextLine(title="A classifier for the message",
|
|
16
|
+
default="message")
|
|
18
17
|
|
|
19
18
|
def prepare(source):
|
|
20
19
|
"""Prepare for being received.
|
|
@@ -32,7 +31,7 @@ class IMessage(zope.interface.Interface):
|
|
|
32
31
|
|
|
33
32
|
class IMessageSource(zope.interface.Interface):
|
|
34
33
|
|
|
35
|
-
def send(message, type=
|
|
34
|
+
def send(message, type="message"):
|
|
36
35
|
"""Send a message to this source.
|
|
37
36
|
|
|
38
37
|
Message can either be a unicode string or an IMessage object.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# -*- coding: latin-1 -*-
|
|
2
1
|
# Copyright (c) 2007 Zope Foundation and Contributors
|
|
3
2
|
# See also LICENSE.txt
|
|
4
3
|
# $Id$
|
|
5
4
|
"""A simple message that can be displayed."""
|
|
6
5
|
|
|
7
6
|
import persistent
|
|
8
|
-
import z3c.flashmessage.interfaces
|
|
9
7
|
import zope.interface
|
|
10
8
|
|
|
9
|
+
import z3c.flashmessage.interfaces
|
|
10
|
+
|
|
11
11
|
|
|
12
12
|
@zope.interface.implementer(z3c.flashmessage.interfaces.IMessage)
|
|
13
13
|
class BaseMessage(persistent.Persistent):
|
|
@@ -17,7 +17,7 @@ class BaseMessage(persistent.Persistent):
|
|
|
17
17
|
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
-
def __init__(self, message, type=
|
|
20
|
+
def __init__(self, message, type="message"):
|
|
21
21
|
self.message = message
|
|
22
22
|
self.type = type
|
|
23
23
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- coding: latin-1 -*-
|
|
2
1
|
# Copyright (c) 2007 Zope Foundation and Contributors
|
|
3
2
|
# See also LICENSE.txt
|
|
4
3
|
# $Id$
|
|
@@ -10,7 +9,7 @@ import z3c.flashmessage.interfaces
|
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
@zope.interface.implementer(z3c.flashmessage.interfaces.IMessageReceiver)
|
|
13
|
-
class GlobalMessageReceiver
|
|
12
|
+
class GlobalMessageReceiver:
|
|
14
13
|
|
|
15
14
|
def receive(self, type=None):
|
|
16
15
|
sources = zope.component.getAllUtilitiesRegisteredFor(
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
# -*- coding: latin-1 -*-
|
|
2
1
|
# Copyright (c) 2007 Zope Foundation and Contributors
|
|
3
2
|
# See also LICENSE.txt
|
|
4
3
|
# $Id$
|
|
5
4
|
"""A message source that stores messages in the session."""
|
|
6
5
|
|
|
6
|
+
import persistent.list
|
|
7
7
|
import zope.interface
|
|
8
|
-
|
|
9
8
|
import zope.session.interfaces
|
|
10
9
|
|
|
11
|
-
import persistent.list
|
|
12
|
-
|
|
13
10
|
import z3c.flashmessage.interfaces
|
|
14
11
|
import z3c.flashmessage.message
|
|
15
12
|
|
|
16
13
|
|
|
17
14
|
@zope.interface.implementer(z3c.flashmessage.interfaces.IMessageSource)
|
|
18
|
-
class ListBasedMessageSource
|
|
15
|
+
class ListBasedMessageSource:
|
|
19
16
|
"""An (abstract) base class that stores messages
|
|
20
17
|
in a list.
|
|
21
18
|
|
|
@@ -24,7 +21,7 @@ class ListBasedMessageSource(object):
|
|
|
24
21
|
|
|
25
22
|
"""
|
|
26
23
|
|
|
27
|
-
def send(self, message, type=
|
|
24
|
+
def send(self, message, type="message"):
|
|
28
25
|
"""Send a message to this source."""
|
|
29
26
|
if not z3c.flashmessage.interfaces.IMessage.providedBy(message):
|
|
30
27
|
# The programmer has passed in not a message, so we create a
|
|
@@ -71,7 +68,6 @@ class SessionMessageSource(ListBasedMessageSource):
|
|
|
71
68
|
persistent.list.PersistentList())
|
|
72
69
|
|
|
73
70
|
|
|
74
|
-
@zope.interface.implementer(z3c.flashmessage.interfaces.IMessageSource)
|
|
75
71
|
class RAMMessageSource(ListBasedMessageSource):
|
|
76
72
|
"""Source which stores its data in RAM.
|
|
77
73
|
|
|
@@ -80,7 +76,7 @@ class RAMMessageSource(ListBasedMessageSource):
|
|
|
80
76
|
"""
|
|
81
77
|
|
|
82
78
|
def __init__(self):
|
|
83
|
-
super(
|
|
79
|
+
super().__init__()
|
|
84
80
|
self._storage = []
|
|
85
81
|
|
|
86
82
|
def _get_storage(self, for_write=False):
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
# -*- coding: latin-1 -*-
|
|
2
1
|
# Copyright (c) 2007 Zope Foundation and Contributors
|
|
3
2
|
# See also LICENSE.txt
|
|
4
3
|
# $Id$
|
|
5
4
|
"""Test harness"""
|
|
6
5
|
|
|
7
6
|
import doctest
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
import zope.app.wsgi.testlayer
|
|
10
9
|
import zope.publisher.browser
|
|
11
10
|
import zope.security.management
|
|
12
11
|
|
|
12
|
+
import z3c.flashmessage
|
|
13
|
+
|
|
13
14
|
|
|
14
15
|
FlashMessageLayer = zope.app.wsgi.testlayer.BrowserLayer(
|
|
15
16
|
z3c.flashmessage, allowTearDown=True)
|