{ "info": { "author": "Grok Team", "author_email": "grok-dev@zope.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "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 :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP" ], "description": "grokcore.message\n*****************\n\nThis package provides integration of `z3c.flashmessage`_ for a grok\nsetup. This means taking care of:\n\n* Registering a global message receiver with the component\n architechture.\n\n* Registering by default a global session-based message source named\n ``session``.\n\n* Optionally (if including ``ram.zcml``) registering a global RAM\n stored message source named ``ram``.\n\n* Providing components to make use of global message receivers and\n sources.\n\nFor details about what kind of messages we are talking about here,\nplease see the `z3c.flashmessage`_ documentation.\n\n.. contents::\n\n\nSetting up ``grokcore.message``\n================================\n\nWhen being grokked, ``grokcore.message`` registers\n\n* a global session message source named ``session``\n\n* a global message receiver.\n\nGrokking of this package happens when the local ``configure.zcml`` is\nexecuted. In standard Grok-based packages this often happens\nautomatically.\n\nOne can, of course, also grok the package manually:\n\n >>> import grokcore.component as grok\n >>> grok.testing.grok('grokcore.message')\n\nThis setups a global message receiver:\n\n >>> from z3c.flashmessage.interfaces import IMessageReceiver\n >>> from zope.component import getUtility\n >>> getUtility(IMessageReceiver)\n \n\nIt also setups a session-based message source named ``session``:\n\n >>> from z3c.flashmessage.interfaces import IMessageSource\n >>> getUtility(IMessageSource, name=u'session')\n \n\nWe provide also a RAM-stored message source that can be enabled by\nincluding ``ram.zcml`` and is not registered by default:\n\n >>> getUtility(IMessageSource, name=u'ram')\n Traceback (most recent call last):\n ...\n zope.interface.interfaces.ComponentLookupError: (, 'ram')\n\n\nYou can enable this source by including ``ram.zcml`` from\n``grokcore.message`` in your ZCML setup like this::\n\n \n \n \n\nor, of course, by registering a RAMMessageSource manually:\n\n >>> from zope.component import provideUtility\n >>> from z3c.flashmessage.sources import RAMMessageSource\n >>> ram_source = RAMMessageSource()\n >>> provideUtility(ram_source, name=u'ram')\n\nNow we can get the RAM source:\n\n >>> getUtility(IMessageSource, name=u'ram')\n \n\nComponents (API)\n================\n\n``grokcore.message`` provides some extra-components and functions\nbeside the usual components from ``z3c.flashmessage``.\n\nUniqueMessageSource\n-------------------\n\nA ``UniqueMessageSource`` is a message source that holds exactly zero\nor one message. Note that messages are not stored persistent in a\n``UniqueMessageSource`` instance and will be lost after restarting\nyour Zope instance.\n\nIt is a baseclass, which means that you have to derive from it to\nregister an instance as global utility upon your software being\ngrokked (see examples below).\n\nMethods:\n\n **UniqueMessageSource.send(message[, type=u'message'])**\n Send a message ``message`` of type ``type``.\n\n **UniqueMessageSource.list(type=None)**\n Returns a generator object listing the message if one is stored.\n\n **UniqueMessageSource.delete(message)**\n Delete the message stored from source, if ``message`` is this\n message.\n\nConvenience functions\n---------------------\n\n``grokcore.message`` provides a couple of convenience functions to\nfeed sources or get data from them.\n\n**grokcore.message.send(message[, type='message'[, name='session']])**\n\n Send ``message`` to the message source ``name``.\n\n Returns ``True`` if the message could be sent\n successfully. Otherwise ``False`` is returned:\n\n >>> import grokcore.message\n >>> grokcore.message.send('Meet at dawn!')\n True\n\n >>> grokcore.message.send('Meat a fawn!', name='doesnotexist')\n False\n\n**grokcore.message.get_from_source([name=''])**\n\n Get a list of messages stored at message source registered under\n name ``name`` or ``None``.\n\n This action never deletes messages from the queried source.\n\n >>> import grokcore.message\n >>> grokcore.message.get_from_source('session')\n \n\n >>> grokcore.message.get_from_source('not-existing') is None\n True\n\n**grokcore.message.receive([name=''])**\n\n Receive the messages collected by the receiver registered under name\n ``name``.\n\n >>> import grokcore.message\n >>> msgs = list(grokcore.message.receive())\n >>> msgs\n []\n\n >>> msgs[0].message\n 'Meet at dawn!'\n\n Please note, that this action might delete messages from the sources\n they have been sent to as by 'receiving' messages you indicate that\n the messages have been processed.\n\n The session source for instance is now empty:\n\n >>> list(grokcore.message.get_from_source('session'))\n []\n\n Receiving again will give no results:\n\n >>> list(grokcore.message.receive())\n []\n\n\nExamples\n========\n\nCreating a ``UniqueMessageSource``:\n\n >>> from grokcore.message import UniqueMessageSource\n >>> class MyUniqueMessageSource(UniqueMessageSource):\n ... grok.name('uniq_source')\n\nAfter being grokked, the source is automatically registered:\n\n >>> grok.testing.grok_component(\n ... 'MyUniqueMessageSource', MyUniqueMessageSource,\n ... dotted_name='grokcore.message.tests')\n True\n\n >>> source = getUtility(IMessageSource, name='uniq_source')\n >>> source\n <...MyUniqueMessageSource object at 0x...>\n\n\nIt provides the methods required by the IMessageSource interface:\n\n >>> from z3c.flashmessage.interfaces import IMessageSource\n >>> from zope.interface import verify\n\n >>> verify.verifyClass(IMessageSource, MyUniqueMessageSource)\n True\n\n\nWe can list the message stored in the source:\n\n >>> source.list()\n \n\n >>> list(source.list())\n []\n\n >>> source.send(message='Hello!', type='message')\n >>> list(source.list())\n []\n\n >>> print(list(source.list())[0].message)\n Hello!\n\nWhen we send another message, the old one will be silenty discarded:\n\n >>> source.send(message='Hello again!', type='message')\n >>> len(list(source.list()))\n 1\n\n >>> print(list(source.list())[0].message)\n Hello again!\n\nWe can delete the message:\n\n >>> msg = list(source.list())[0]\n >>> source.delete(msg)\n >>> len(list(source.list()))\n 0\n\nExamples for the convenience functions can be found above.\n\n\n.. _z3c.flashmessage: http://pypi.python.org/pypi/z3c.flashmessage\n\n\nCHANGES\n*******\n\n3.0.1 (2018-01-17)\n==================\n\n- Replace the use of `grok.implements()` with the `@grok.implementer()`\n directive throughout.\n\n3.0.0 (2018-01-15)\n==================\n\n- Python 3 compatibility.\n\n0.4.3 (2016-02-15)\n==================\n\n- Update tests.\n\n0.4.2 (2010-10-25)\n==================\n\n- Tests fixed by explicitely registering the IClientIdManager and\n ISessionDataContainer utilities. The ftesting.zcml was re-introduced for this.\n\n0.4.1 (2010-10-25)\n==================\n\n- Remove ftesting.zcml that was not necessary anymore.\n\n0.4 (2010-10-25)\n================\n\n* Make sure ``zope.session`` is configured, as this package claims to provide\n for a session based flash message machinery.\n\n* Made package comply to zope.org repository policy.\n\n0.3 (2010-03-05)\n================\n\n* ``UniqueMessageSource`` now implements the ``IMessageSource``\n interface completely, i.e. the ``type`` parameter is now optional\n when using ``UniqueMessageSource.send()``.\n\n0.2 (2010-03-03)\n================\n\n* The utility function ``send`` now takes a ``name`` argument,\n allowing the choice of the target message source.\n\n0.1 (2010-03-03)\n================\n\n* Factored out from former versions of ``grokui.admin``, ``grok`` and\n ``megrok.layout`` respectively.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/grokcore.message", "keywords": "Grok Messages", "license": "ZPL 2.1", "maintainer": "", "maintainer_email": "", "name": "grokcore.message", "package_url": "https://pypi.org/project/grokcore.message/", "platform": "", "project_url": "https://pypi.org/project/grokcore.message/", "project_urls": { "Homepage": "http://pypi.python.org/pypi/grokcore.message" }, "release_url": "https://pypi.org/project/grokcore.message/3.0.1/", "requires_dist": null, "requires_python": "", "summary": "Grok messaging machinery", "version": "3.0.1" }, "last_serial": 3496945, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "bb5b39abd72b9a9b312503c0706a5574", "sha256": "c2f72a1ea2ad36c60f6baee81b10b2c8aa4fae60cd222af9eeaf2709fc03ad07" }, "downloads": -1, "filename": "grokcore.message-0.1.tar.gz", "has_sig": false, "md5_digest": "bb5b39abd72b9a9b312503c0706a5574", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8917, "upload_time": "2010-03-03T17:40:16", "url": "https://files.pythonhosted.org/packages/9d/ad/6191b2e42ab4cc08d7c2b46400bd93848ed993699bbc79aaf48ef44c3199/grokcore.message-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "51cf2f45020b16f75a54832f7a267581", "sha256": "d51b1f90e7e47a96cc9a553a776103af4ab42b267eed8b466faa4db9c52cbde1" }, "downloads": -1, "filename": "grokcore.message-0.2.tar.gz", "has_sig": false, "md5_digest": "51cf2f45020b16f75a54832f7a267581", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9196, "upload_time": "2010-03-03T23:04:57", "url": "https://files.pythonhosted.org/packages/d0/50/b0b08f0b6fcb4c807a4177cae4cdf5d775cdb0881d5fa12a4977105fd84f/grokcore.message-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "a13fe8140e179597c3e272e75203dc77", "sha256": "412408e0d636a50de37a0da47bf05a7c68ed6d3c915388c25711079a48a055b0" }, "downloads": -1, "filename": "grokcore.message-0.3.tar.gz", "has_sig": false, "md5_digest": "a13fe8140e179597c3e272e75203dc77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9138, "upload_time": "2010-03-05T15:57:45", "url": "https://files.pythonhosted.org/packages/9a/40/ef7feb3b7fea9de6a8eb8739d746a9e8ba2148bbdd66c315fbe89dcfdcec/grokcore.message-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "c6aa4d8e7080868ff74b41b221d1e8f7", "sha256": "a0dba46085c62bde2d2a44d17b2735d4908ed4323a440c3423cb576b61b7c02d" }, "downloads": -1, "filename": "grokcore.message-0.4.tar.gz", "has_sig": false, "md5_digest": "c6aa4d8e7080868ff74b41b221d1e8f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11499, "upload_time": "2010-10-25T16:46:04", "url": "https://files.pythonhosted.org/packages/77/bf/8ca41253dbf81d4d6bc0342808eeb6dbd428cbcaccb35ff48a80024856bc/grokcore.message-0.4.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "0cfbcc8350c1f7a5923810563505a99f", "sha256": "5620f09b41b463f9985490da1d10aa4a387f9c6a64b41e6527ca02b2cf01ef66" }, "downloads": -1, "filename": "grokcore.message-0.4.1.tar.gz", "has_sig": false, "md5_digest": "0cfbcc8350c1f7a5923810563505a99f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11342, "upload_time": "2010-10-25T16:47:28", "url": "https://files.pythonhosted.org/packages/98/8a/8ed7a536bc151dff200d3eb6da1c93c6c2a0fdfcda852d897b3ce57c0d1b/grokcore.message-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "ca01a0effa84f83b949f13a63a449d46", "sha256": "94694a5226e95e36bca7c8c54f5c144dcc389dbb58c76ccea75f518a2f30ae9d" }, "downloads": -1, "filename": "grokcore.message-0.4.2.tar.gz", "has_sig": false, "md5_digest": "ca01a0effa84f83b949f13a63a449d46", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11709, "upload_time": "2010-10-25T18:18:32", "url": "https://files.pythonhosted.org/packages/50/fb/8089606c2c87e1c5c7200c06136a6bf4e6c7e85c56ff03c752b358835723/grokcore.message-0.4.2.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "319538936bd549c487a97c8af0902670", "sha256": "da7db90f0c0a26c6cff173e5392b53227ec20ff85ff0a95af2d0b8600759ddfc" }, "downloads": -1, "filename": "grokcore.message-0.4.3.tar.gz", "has_sig": false, "md5_digest": "319538936bd549c487a97c8af0902670", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11527, "upload_time": "2016-02-15T16:07:52", "url": "https://files.pythonhosted.org/packages/14/bb/1453c4c945cf4354482d014e8d2cd8aee9a06a8c48bb56173f809566bbc4/grokcore.message-0.4.3.tar.gz" } ], "3.0.0": [ { "comment_text": "", "digests": { "md5": "9650a1d871ce7f729be2f49f23ff39c4", "sha256": "c50f0a1d56d6efc8b4e9d93eada93c4648279eb1bb6ec0c16255bb832f999418" }, "downloads": -1, "filename": "grokcore.message-3.0.0.tar.gz", "has_sig": false, "md5_digest": "9650a1d871ce7f729be2f49f23ff39c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11905, "upload_time": "2018-01-15T09:08:18", "url": "https://files.pythonhosted.org/packages/a7/ba/934ac9ca4f86bb07d2440f29de6cc88687f72704357acfad32283a9798e7/grokcore.message-3.0.0.tar.gz" } ], "3.0.1": [ { "comment_text": "", "digests": { "md5": "5d3ce03f1e31167a61433a7477260d27", "sha256": "eba86ab71a1e27ae5d37d6a68971ca338456fe1d363d11ddca4c5749cef2e051" }, "downloads": -1, "filename": "grokcore.message-3.0.1.tar.gz", "has_sig": false, "md5_digest": "5d3ce03f1e31167a61433a7477260d27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12007, "upload_time": "2018-01-17T12:42:35", "url": "https://files.pythonhosted.org/packages/68/2f/4a9713b57f3e12bbb9c8a728167994672ee389ac72624c280f11b59ad7fa/grokcore.message-3.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5d3ce03f1e31167a61433a7477260d27", "sha256": "eba86ab71a1e27ae5d37d6a68971ca338456fe1d363d11ddca4c5749cef2e051" }, "downloads": -1, "filename": "grokcore.message-3.0.1.tar.gz", "has_sig": false, "md5_digest": "5d3ce03f1e31167a61433a7477260d27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12007, "upload_time": "2018-01-17T12:42:35", "url": "https://files.pythonhosted.org/packages/68/2f/4a9713b57f3e12bbb9c8a728167994672ee389ac72624c280f11b59ad7fa/grokcore.message-3.0.1.tar.gz" } ] }