{ "info": { "author": "Chris Withers", "author_email": "chris@simplistix.co.uk", "bugtrack_url": null, "classifiers": [], "description": "====\nWASP\n====\n\nThis package is an abstraction of interactions with WASPs allowing\napplication developers to send and recieve messages without having to\nworry about the mechanics of sending and recieving messages with a\nparticular wasp.\n\nIt also allows the WASP being used to be changed by configuration\nonly, without any changes to application code.\n\nInstallation\n============\n\nTo install the package, unpack the source distribution and then do::\n\n python setup.py install\n\nYou can also install with easy_install::\n\n easy_install wasp\n\nAlternatively, if you're using zc.buildout, you can just specify the\npackage as an egg requirement::\n\n [buildout]\n parts = myeggs ...\n ...\n\n [myeggs]\n recipe = zc.recipe.egg\n eggs = wasp\n ...\n\nFinally, if you're using with Zope 2, just unpack the source\ndistribution into $INSTANCE_HOME/lib/python.\nBe careful if you use easy_install or a buildout recipe *with* a Zope\n2 base distribution, such as that used by Plone, as versions of the\npackages requires by `wasp` may be installed that are incompatible\nwith Zope 2.\n\nConfiguration\n=============\n\nThe configuration of sending and receiving messages centres around the\nconfiguration of utilities providing ISendMessage, INotifyMessage and\nIRecieveMessage. Reading the documentation for these in interfaces.py\nwill cover a lot of the explanation required to use the `wasp`\npackage.\n\nTo use the package, the first thing you'll need to do is choose a WASP\nimplementation and load any ZCML directives it provides. For the\nexamples here, we'll use the demo implementations which basically echo\nall their actions to the console rather than actually doing anything::\n\n >>> load_zcml('''\n ... \n ... ''')\n\nIn order to send messages, you need to wire in the ISendMessage\nutility of your chosen WASP. WASP implementations usually provide a\ncustom ZCML directive for doing this which allows you to specify the\nparameters.\n\nThe demo implementation is no exception::\n\n >>> load_zcml('''\n ... \n ... \n ... \n ... ''')\n\nNext, if you're planning on receiving messages or notifications about\nmessages you've sent, you need to wire in the Receiver view. For\ndemonstration purposes, we wire it to all objects, but you probably\nonly want to wire it in such that it appears at one particular url.\n\n >>> load_zcml('''\n ... \n ... \n ... \n ... ''')\n\nAgain, if you're planning on receiving messages or notifications about\nmessages you've sent, you need to wire in an IProcessReponse\nutility. This is WASP-specific but can be changed independently of\nwhere the Receiver view is or how it's wired in. This means that\napplication developers only have to worry about wiring in the Receiver\nview where they want it and system administrators can choose and\nchange the WASP implementation used whenever they want.\n\nFor the examples, we'll use a `wasp.demo.ProcessResponse`\nimplementation::\n\n >>> load_zcml('''\n ... \n ... \n ... \n ... ''')\n\nSending Messages\n================\n\nOnce configured, sending messages is as simple as::\n\n >>> from wasp import send\n >>> send('271234','some message')\n Send to: '271234'\n Message: 'some message'\n Id: None\n True\n\nAs this shows, the send method takes an `msisdn`, a `message` and\noptionally a `message_id`.\n\nIf `send` returns True, it indicates that the message has been\nsuccessfully delivered. If something goes wrong, an exception will be\nraised.\n\nHowever, the most common case is when send returns False::\n\n >>> load_zcml('''\n ... \n ... \n ... \n ... ''')\n >>> send('271234','some message','id4321')\n Send to: '271234'\n Message: 'some message'\n Id: 'id4321'\n False\n\nA return value of False means that the message has successfully been\npassed to the WASP, but the WASP didn't have a definite response at\nthis stage. To find out what happened, the application progammer must\npass a `message_id`. This will be passed to the WASP and when the WASP\ncalls back, this `message_id` will be returned. This is the subject of\nthe next section.\n\nReceiving Notifications About Sent Messages\n===========================================\n\nTo receive notifications about sent messages, the application\nprogrammer must provide an INotifyMessage utility.\n\nHere's a really simple example of this::\n\n >>> class HandleNotification:\n ... def __call__(self,message_id,status,details):\n ... print \"message_id:\",repr(message_id)\n ... print \" status:\",repr(status)\n ... print \" details:\",repr(details)\n \nNormally, we'd register this utility with ZCML, but here we do so\ndirectly with the component architecture::\n\n >>> from wasp.interfaces import INotifyMessage\n >>> from zope.component import provideUtility\n >>> provideUtility(HandleNotification(),provides=INotifyMessage)\n\nWe can show this in action by using the demo WASP implementations\nmethod of calling back::\n\n >>> browser.open('http://localhost/@@wasp?type=notification&message_id=123&status=delivered&details=ok')\n message_id: u'123'\n status: \n details: u'ok'\n\nNow, in some cases, particularly if data is stored in the zodb, it's\nconvenient to have access to the context of the Receiver view. The\n`wasp` package supports this by letting you register an adapter\ninstead of a utility.\n\nHere's a simple example of a suitable adapter::\n\n >>> class HandleNotification:\n ... def __init__(self,context):\n ... self.context = context\n ... def __call__(self,message_id,status,details):\n ... print \" context:\",self.context\n ... print \"message_id:\",repr(message_id)\n ... print \" status:\",repr(status)\n ... print \" details:\",repr(details)\n \nThis should generally be registered for all objects as the Receiver\nview will make sure that only its context is adapted::\n\n >>> from wasp.interfaces import INotifyMessage\n >>> from zope.component import provideAdapter\n >>> provideAdapter(HandleNotification,adapts=(None,),provides=INotifyMessage)\n\nNow when a notification is received, the code called has access to the\ncontext::\n\n >>> browser.open('http://localhost/@@wasp?type=notification&message_id=123&status=delivered&details=ok')\n context: \n message_id: u'123'\n status: \n details: u'ok'\n\n\nReceiving Messages\n==================\n\nTo receive messages, the application programmer must provide an\nIReceiveMessage utility. \n\nHere's a really simple example of this::\n\n >>> class HandleMessage:\n ... def __call__(self,msisdn,message_text):\n ... print \" msisdn:\",repr(msisdn)\n ... print \"message_text:\",repr(message_text)\n\nNormally, we'd register this utility with ZCML, but here we do so\ndirectly with the component architecture::\n\n >>> from wasp.interfaces import IReceiveMessage\n >>> from zope.component import provideUtility\n >>> provideUtility(HandleMessage(),provides=IReceiveMessage)\n\nWe can show this in action by using the demo WASP implementations\nmethod of calling back::\n\n >>> browser.open('http://localhost/@@wasp?type=message&msisdn=123&message_text=my+message')\n msisdn: u'123'\n message_text: u'my message'\n\nNow, in some cases, particularly if data is stored in the zodb, it's\nconvenient to have access to the context of the Receiver view. The\n`wasp` package supports this by letting you register an adapter\ninstead of a utility.\n\nHere's a simple example of a suitable adapter::\n\n >>> class HandleMessage:\n ... def __init__(self,context):\n ... self.context = context\n ... def __call__(self,msisdn,message_text):\n ... print \" context:\",self.context\n ... print \" msisdn:\",repr(msisdn)\n ... print \"message_text:\",repr(message_text)\n \nThis should generally be registered for all objects as the Receiver\nview will make sure that only its context is adapted::\n\n >>> from wasp.interfaces import IReceiveMessage\n >>> from zope.component import provideAdapter\n >>> provideAdapter(HandleMessage,adapts=(None,),provides=IReceiveMessage)\n\nNow when a message is received, the code called has access to the\ncontext::\n\n >>> browser.open('http://localhost/@@wasp?type=message&msisdn=123&message_text=my+message')\n context: \n msisdn: u'123'\n message_text: u'my message'\n\n\nCurrently Available WASPs\n=========================\n\nDocumentation for the configuration of the currently avalable WASPs is\nfound in the 'readme.txt' of each of the `wasp` subpackages. Each\nsubpackage represents a different WASP implementation.\n\nThe currently available WASP implementations are listed below:\n\n*demo*\n a WASP for testing that just echos requests and responses.\n\n*bulksms*\n an implementation for the service provided by\n http://bulksms.2way.co.za/\n\nLicensing\n=========\n\nCopyright (c) 2008 Simplistix Ltd\n\nThis Software is released under the MIT License:\nhttp://www.opensource.org/licenses/mit-license.html\nSee license.txt for more details.\n\nCredits\n=======\n\n**Roche Compaan and Rijk Stofberg at Upfront**\n Ideas and funding\n\n**Chris Withers**\n Development\n\nChanges\n=======\n\n1.0.1\n-----\n\n- first open source release\n\n1.0.0\n-----\n\n- implementation for BulkSMS WASP.\n\n- clarified the meaning of `msisdn` in IReceiveMessage\n\n- added a generic SendException for use by WASP implementations.\n\n- change IProcessResponse to cater for returning notifications,\n messages *and* a response for the browser\n\n0.9.0\n-----\n\n- initial release featuring only the demo implementation.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": null, "license": "All rights reserved", "maintainer": null, "maintainer_email": null, "name": "wasp", "package_url": "https://pypi.org/project/wasp/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/wasp/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/wasp/1.0.1/", "requires_dist": null, "requires_python": null, "summary": "A library for abstracting interactions with different WASPs", "version": "1.0.1" }, "last_serial": 801521, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "f62b0ded244dfe1fd87c72e0197a8ac3", "sha256": "b1c1725cda847779610132e4ab48ac65ca0fb87d38d5f851e43570c052370a87" }, "downloads": -1, "filename": "wasp-1.0.1-py2.4.egg", "has_sig": false, "md5_digest": "f62b0ded244dfe1fd87c72e0197a8ac3", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 48696, "upload_time": "2008-09-17T15:48:17", "url": "https://files.pythonhosted.org/packages/47/58/a229afdcfea6a8b14b3e03f672e193d5272cb39988250bfa44729b0c78b1/wasp-1.0.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "759f504066116c29a5bd0077b3267ceb", "sha256": "cbd59de4a99d7b5db7fca9b2db832ce5969638a871c48a5c5a9240582182c11b" }, "downloads": -1, "filename": "wasp-1.0.1.tar.gz", "has_sig": false, "md5_digest": "759f504066116c29a5bd0077b3267ceb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19147, "upload_time": "2008-09-17T15:48:16", "url": "https://files.pythonhosted.org/packages/45/2e/b8134455fa6e98695ebc9a59c47cd0a73ef556c7c54fc2b0c9fe95153f26/wasp-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f62b0ded244dfe1fd87c72e0197a8ac3", "sha256": "b1c1725cda847779610132e4ab48ac65ca0fb87d38d5f851e43570c052370a87" }, "downloads": -1, "filename": "wasp-1.0.1-py2.4.egg", "has_sig": false, "md5_digest": "f62b0ded244dfe1fd87c72e0197a8ac3", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 48696, "upload_time": "2008-09-17T15:48:17", "url": "https://files.pythonhosted.org/packages/47/58/a229afdcfea6a8b14b3e03f672e193d5272cb39988250bfa44729b0c78b1/wasp-1.0.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "759f504066116c29a5bd0077b3267ceb", "sha256": "cbd59de4a99d7b5db7fca9b2db832ce5969638a871c48a5c5a9240582182c11b" }, "downloads": -1, "filename": "wasp-1.0.1.tar.gz", "has_sig": false, "md5_digest": "759f504066116c29a5bd0077b3267ceb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19147, "upload_time": "2008-09-17T15:48:16", "url": "https://files.pythonhosted.org/packages/45/2e/b8134455fa6e98695ebc9a59c47cd0a73ef556c7c54fc2b0c9fe95153f26/wasp-1.0.1.tar.gz" } ] }