{ "info": { "author": "Jasper Op de Coul, Christian Theune", "author_email": "jasper@infrae.com, mail@gocept.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Zope :: 3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP" ], "description": ".. contents::\n\n\n\n==============\nFlash messages\n==============\n\nComponents to display small messages to users.\n\n\nSending a message to the current user\n=====================================\n\nTo send a message to the current user, you can use the session-based message\nsource. Let's set one up:\n\n>>> from z3c.flashmessage.sources import SessionMessageSource\n>>> from __future__ import unicode_literals\n>>> source = SessionMessageSource()\n\n>>> source.send('The world will come to an end in 40 seconds!')\n\nThe source allows to list all current messages:\n\n>>> m = list(source.list())\n>>> m\n[]\n>>> m[0].message\n'The world will come to an end in 40 seconds!'\n>>> str(m[0].type)\n'message'\n\nReceiving messages\n==================\n\nThe standard message that is generated removes itself from the source when it\nis received. The receiver will call `prepare()` on the message before it is\nhanded out to the code that receives it:\n\n>>> m[0].prepare(source)\n>>> list(source.list())\n[]\n\nThere also is another default message that does not delete itself when being\nread:\n\n>>> from z3c.flashmessage.message import PersistentMessage\n>>> source.send(PersistentMessage('I will stay forever!'))\n>>> m = list(source.list())[0]\n>>> m.message\n'I will stay forever!'\n>>> m.prepare(source)\n>>> list(source.list())\n[]\n\nGlobal receiver\n===============\n\nThere is a global receiver that queries all message sources that are set up as\nutilities. Let's set up a session message source as a utility:\n\n>>> from zope.component import provideUtility\n>>> provideUtility(source)\n>>> source.send('Test!')\n\n>>> from z3c.flashmessage.sources import RAMMessageSource\n>>> source2 = RAMMessageSource()\n>>> provideUtility(source2, name='other')\n>>> source2.send('Test 2!')\n>>> source2.send('Test 3!')\n\n>>> from z3c.flashmessage.receiver import GlobalMessageReceiver\n>>> receiver = GlobalMessageReceiver()\n>>> m = list(receiver.receive())\n>>> len(m)\n4\n>>> m[0].message\n'I will stay forever!'\n>>> m[1].message\n'Test!'\n>>> m[2].message\n'Test 2!'\n>>> m[3].message\n'Test 3!'\n\nAfter the receiver handed out the messages, they are gone from the\nsources, because the receiver notifies the messages that they were\nread:\n\n>>> len(list(receiver.receive()))\n1\n\n\nFiltering message types\n=======================\n\nWhen listing messages from a message source, we can restrict which messages we\nsee. If we don't give a type, then all messages are returned. The default type\nof a message is `message`:\n\n>>> source3 = RAMMessageSource()\n>>> source3.send('Test 2!')\n>>> list(source3.list())\n[]\n>>> list(source3.list('message'))\n[]\n>>> list(source3.list('somethingelse'))\n[]\n\n\nPerformance and Scalability Issues\n==================================\n\nBy default, messages are stored persistently in the ZODB using\nzope.session. This can be a significant scalability problem; see\ndesign.txt in zope.session for more information. You should think\ntwice before using flashmessages for unauthenticated users, as this\ncan easily lead to unnecessary database growth on anonymous page\nviews, and conflict errors under heavy load.\n\nOne solution is to configure your system to store flashmessages in\nRAM. You would do this by configuring a utility providing\n``z3c.flashmessage.interfaces.IMessageSource`` with the factory set to\n``z3c.flashmessage.sources.RAMMessageSource``, and a specific name if\nyour application expects one.\n\nRAM storage is much faster and removes the persistence issues\ndescribed above, but there are two new problems. First, be aware that\nif your server process restarts for any reason, all unread\nflashmessages will be lost. Second, if you cluster your application\nservers using e.g. ZEO, you must also ensure that your load-balancer\nsupports session affinity (so a specific client always hits the same\nback end server). This somewhat reduces the performance benefits of\nclustering.\n\n\n=======\nCHANGES\n=======\n\n2.1 (2018-11-12)\n================\n\n- Claim support for Python 3.6, 3.7, PyPy and PyPy3.\n\n- Drop support for Python 3.3.\n\n- Drop support for ``python setup.py test``.\n\n\n2.0 (2016-08-08)\n================\n\n- Standardize namespace ``__init__``.\n\n- Claim compatibility for Python 3.3, 3.4, and 3.5.\n\n1.3 (2010-10-28)\n================\n\n- ``SessionMessageSource`` implicitly created sessions when the client was\n reading the messages from the source. Changed internal API so reading no\n longer creates a session when it not yet exists.\n\n1.2 (2010-10-19)\n================\n\n* Removed test dependency on `zope.app.zcmlfiles`.\n\n\n1.1 (2010-10-02)\n================\n\n* Removed test dependency on `zope.app.testing`.\n\n\n1.0 (2007-12-06)\n================\n\n* Updated dependency to `zope.session` instead of `zope.app.session` to get\n rid of deprecation warnings.\n\n\n1.0b2 (2007-09-12)\n==================\n\n* Bugfix: When there was more than one message in a source not all messages\n would be returned by the receiver.\n\n1.0b1 (2007-08-22)\n==================\n\n* Initial public release.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zopefoundation/z3c.flashmessage", "keywords": "zope3 message zope session", "license": "ZPL 2.1", "maintainer": "", "maintainer_email": "", "name": "z3c.flashmessage", "package_url": "https://pypi.org/project/z3c.flashmessage/", "platform": "", "project_url": "https://pypi.org/project/z3c.flashmessage/", "project_urls": { "Homepage": "https://github.com/zopefoundation/z3c.flashmessage" }, "release_url": "https://pypi.org/project/z3c.flashmessage/2.1/", "requires_dist": [ "ZODB", "setuptools", "zope.interface", "zope.schema", "zope.session", "Webtest; extra == 'test'", "zope.app.wsgi[testlayer] (>=4.0); extra == 'test'", "zope.component; extra == 'test'", "zope.publisher; extra == 'test'", "zope.security; extra == 'test'", "zope.testrunner; extra == 'test'" ], "requires_python": "", "summary": "A package for sending `flash messages` to users.", "version": "2.1" }, "last_serial": 4477699, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "bb8d8d35aaadb9e3a4daf343f0cde5be", "sha256": "a59763ef18e48f587a0ca611bf9494ddaec285b909f022505ccc9f7d8ee8f373" }, "downloads": -1, "filename": "z3c.flashmessage-1.0.tar.gz", "has_sig": false, "md5_digest": "bb8d8d35aaadb9e3a4daf343f0cde5be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6563, "upload_time": "2007-12-06T10:30:54", "url": "https://files.pythonhosted.org/packages/7e/b4/ffadf742876c0d217600811e13fece8eaf95d731b7f6c48e28e96082204c/z3c.flashmessage-1.0.tar.gz" } ], "1.0b1": [ { "comment_text": "", "digests": { "md5": "afb27ab4b8374549aa620d05104aa361", "sha256": "f267828f78f200c3db061a0c067cb0a6f427416326378b45af9cf4960e5abd3d" }, "downloads": -1, "filename": "z3c.flashmessage-1.0b1-py2.4.egg", "has_sig": false, "md5_digest": "afb27ab4b8374549aa620d05104aa361", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 13435, "upload_time": "2007-08-22T09:06:42", "url": "https://files.pythonhosted.org/packages/99/ae/e8c41f4228c6a38386a7f68cb7174fa9c8f290dfe5372998fecf5f58ddd7/z3c.flashmessage-1.0b1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "11a1253a63e83e8a729d3eb6ab88429a", "sha256": "45b7fd2a9d3b9aa266697c662125df743a9bb0c9ca05f6ffbbc00f07946f423d" }, "downloads": -1, "filename": "z3c.flashmessage-1.0b1.tar.gz", "has_sig": false, "md5_digest": "11a1253a63e83e8a729d3eb6ab88429a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5762, "upload_time": "2007-08-22T09:06:42", "url": "https://files.pythonhosted.org/packages/31/72/7c954d7a1c36f9f6aa79add143d888c12b0c549df602f5054bbc3261322b/z3c.flashmessage-1.0b1.tar.gz" } ], "1.0b2": [ { "comment_text": "", "digests": { "md5": "93b8dbc9f39e0e68400452908ba7eb95", "sha256": "9d03b572a67f209b3c6393f7f89a98457c9ff33a966ad4fd8012607e4f78f6ed" }, "downloads": -1, "filename": "z3c.flashmessage-1.0b2.tar.gz", "has_sig": true, "md5_digest": "93b8dbc9f39e0e68400452908ba7eb95", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6872, "upload_time": "2007-09-12T13:00:27", "url": "https://files.pythonhosted.org/packages/70/a2/b1c1eca6506ed15c14f67c6993dab39851fc52264c7d742b6ff8c9095741/z3c.flashmessage-1.0b2.tar.gz" } ], "1.0dev-r77758": [ { "comment_text": "", "digests": { "md5": "e7f3c09d93b0a01843e408071c5c3c64", "sha256": "3b0d691d06cffc5171622e27a357b8baa80598d96759d2bb688e394c79a373a5" }, "downloads": -1, "filename": "z3c.flashmessage-1.0dev-r77758.tar.gz", "has_sig": false, "md5_digest": "e7f3c09d93b0a01843e408071c5c3c64", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5854, "upload_time": "2007-07-12T15:35:18", "url": "https://files.pythonhosted.org/packages/24/08/d0e3a18fa9829161a67a8a9411a4fa83a4bf57c0312636470348ea93c230/z3c.flashmessage-1.0dev-r77758.tar.gz" } ], "1.0dev-r77761": [ { "comment_text": "", "digests": { "md5": "e4446f989919d7b4199976aae18dc28d", "sha256": "48da84b71acdb1af43e2e9a52f98bd3dd22288cc1790a7def44a7bcf9658fc08" }, "downloads": -1, "filename": "z3c.flashmessage-1.0dev-r77761.tar.gz", "has_sig": false, "md5_digest": "e4446f989919d7b4199976aae18dc28d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5849, "upload_time": "2007-07-12T15:47:30", "url": "https://files.pythonhosted.org/packages/82/6d/92442ff53a4b0ee2dd81f09c20ac29be820003607c7fcffca31292e289d7/z3c.flashmessage-1.0dev-r77761.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "e7e58e351481dbb3c60d9e9392430cf5", "sha256": "faca5418be7b5dbb6eba4808fe2c5b4e55c1141d7df5d884dca7fb4f6b9d489a" }, "downloads": -1, "filename": "z3c.flashmessage-1.1.tar.gz", "has_sig": false, "md5_digest": "e7e58e351481dbb3c60d9e9392430cf5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8121, "upload_time": "2010-10-02T15:21:49", "url": "https://files.pythonhosted.org/packages/da/80/5d47993e7999d226c406cbfa7123cb060083bc1a22ec369433a1172c4dc0/z3c.flashmessage-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "148c55ddbbd9f6904d77a75999ce6fb4", "sha256": "121da2ff9d051719544c4874fd5080b300615b140d90e8a74703cd4ff96faa96" }, "downloads": -1, "filename": "z3c.flashmessage-1.2.tar.gz", "has_sig": false, "md5_digest": "148c55ddbbd9f6904d77a75999ce6fb4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9677, "upload_time": "2010-10-19T10:27:37", "url": "https://files.pythonhosted.org/packages/89/6e/28e8b5aeea145a03094a65e003202d3ed8668d8cb0e72680b6d391c8da1e/z3c.flashmessage-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "86a0a154e68de5300670e0340952c93d", "sha256": "459cb2bfc55724a9011b6d186e46e76d8d4a124c7382c4d7fe5bb19cf98880be" }, "downloads": -1, "filename": "z3c.flashmessage-1.3.tar.gz", "has_sig": false, "md5_digest": "86a0a154e68de5300670e0340952c93d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8469, "upload_time": "2010-10-28T14:45:54", "url": "https://files.pythonhosted.org/packages/73/bf/72464b84da83e834e6f9003e729cba3307ea6ea30cd360a0ae5d2f44f9cd/z3c.flashmessage-1.3.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "02c4990dd8c0fe36a3a511b87c9718a0", "sha256": "ee6bb8e93a8e2be5e76b649624805928089fc21c49a1410007300acb188bba0d" }, "downloads": -1, "filename": "z3c.flashmessage-2.0.tar.gz", "has_sig": false, "md5_digest": "02c4990dd8c0fe36a3a511b87c9718a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12254, "upload_time": "2016-08-08T15:02:06", "url": "https://files.pythonhosted.org/packages/ac/96/b279e6137461f3a0b80545dab7266ae4c11b1b7c030632f3868d9844afe3/z3c.flashmessage-2.0.tar.gz" } ], "2.1": [ { "comment_text": "", "digests": { "md5": "76510c266c043104d954fb0191c6624b", "sha256": "337b7a88d02c282ab8c649208d7abb90d8e4d57fd4ab761814de953e783c16be" }, "downloads": -1, "filename": "z3c.flashmessage-2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "76510c266c043104d954fb0191c6624b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14309, "upload_time": "2018-11-12T15:04:00", "url": "https://files.pythonhosted.org/packages/e0/d0/4d65348a53f5ff1f6599d604b4f590773143a425705c3d86bfe3ba9d9e28/z3c.flashmessage-2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0db1cc49fa28f812fb4ac99c8655efc4", "sha256": "4bf644d01f1e63782bee0ef9735e4dd58fb4af01f76b680375fa3e37ac9e89af" }, "downloads": -1, "filename": "z3c.flashmessage-2.1.tar.gz", "has_sig": false, "md5_digest": "0db1cc49fa28f812fb4ac99c8655efc4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13398, "upload_time": "2018-11-12T15:04:02", "url": "https://files.pythonhosted.org/packages/c5/31/a473718efd7064440368194b1363dfd03775dc2502f4ff98bf6ed330af59/z3c.flashmessage-2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "76510c266c043104d954fb0191c6624b", "sha256": "337b7a88d02c282ab8c649208d7abb90d8e4d57fd4ab761814de953e783c16be" }, "downloads": -1, "filename": "z3c.flashmessage-2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "76510c266c043104d954fb0191c6624b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14309, "upload_time": "2018-11-12T15:04:00", "url": "https://files.pythonhosted.org/packages/e0/d0/4d65348a53f5ff1f6599d604b4f590773143a425705c3d86bfe3ba9d9e28/z3c.flashmessage-2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0db1cc49fa28f812fb4ac99c8655efc4", "sha256": "4bf644d01f1e63782bee0ef9735e4dd58fb4af01f76b680375fa3e37ac9e89af" }, "downloads": -1, "filename": "z3c.flashmessage-2.1.tar.gz", "has_sig": false, "md5_digest": "0db1cc49fa28f812fb4ac99c8655efc4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13398, "upload_time": "2018-11-12T15:04:02", "url": "https://files.pythonhosted.org/packages/c5/31/a473718efd7064440368194b1363dfd03775dc2502f4ff98bf6ed330af59/z3c.flashmessage-2.1.tar.gz" } ] }