{ "info": { "author": "Kai Lautaportti", "author_email": "kai.lautaportti@hexagonit.fi", "bugtrack_url": null, "classifiers": [ "Framework :: Plone", "Framework :: Zope2", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "****************************************\nCollection of useful function decorators\n****************************************\n\n.. contents::\n\nThe package contains function decorators that help implementing\nrepetitive tasks. It is mostly oriented towards Zope development.\n\nChange History\n**************\n\n0.2 (2007-09-05)\n================\n\n - Fixed problem with methods not being passed parameters from the\n query string. When a view method was called directly using an URL\n the parameters from the query string were lost when a view method\n was decorated. The decorators now push back the query parameters\n into the method call.\n\n0.1 (2007-08-31)\n================\n\n - First public release.\n\nDetailed Documentation\n**********************\n\n``browser`` module\n==================\n\nThis module provides decorators that are useful with Zope 3 browser\nviews (also usable in Zope 2).\n\nJSON decorator\n==============\n\nThe JSON decorator uses simplejson_ to encode the return value of the\ndecorated function as JSON.\n\n.. _simplejson: http://pypi.python.org/pypi/simplejson\n\n >>> from hexagonit.decorators.browser import json\n\n >>> @json\n ... def json_callback():\n ... \"\"\"JSON callback method.\"\"\"\n ... return {'bool' : (True, False) }\n >>> json_callback()\n '{\"bool\": [true, false]}'\n\nAny keyword arguments passed to the decorator will be passed on to the\n``simplejson.dumps`` function.\n\n >>> @json(sort_keys=True, ensure_ascii=False)\n ... def json_callback():\n ... \"\"\"JSON callback method.\"\"\"\n ... return {'foo' : None, 'bool' : (True, False), 'ints' : [1,2,3]}\n >>> json_callback()\n u'{\"bool\": [true, false], \"foo\": null, \"ints\": [1, 2, 3]}'\n \n\n\nHTTP cache disabling decorator\n==============================\n\nThe ``nocache`` decorator is used for Zope 3 views and sets the\nappropriate HTTP headers to disable caching for the results of the\ndecorated method.\n\n >>> from hexagonit.decorators.browser import nocache\n\nWe'll demonstrate the use of the decorator with a dummy view object.\n\n >>> class Dummy(object):pass\n >>> class BrowserView(object):\n ... \"\"\"Dummy view class that fakes the ``request`` object.\"\"\"\n ... def __init__(self):\n ... self.request = Dummy()\n ... self.request.response = Dummy()\n ... self.headers = []\n ... self.request.response.setHeader = lambda header,value: self.headers.append('%s: %s' % (header, value))\n ... \n ... @nocache\n ... def ajax_callback(self):\n ... print '\\n'.join(self.headers)\n\n >>> view = BrowserView()\n >>> view.ajax_callback()\n Pragma: no-cache\n Expires: Sat, 1 Jan 2000 00:00:00 GMT\n Cache-Control: no-cache, must-revalidate\n\nIt is also possible to use both the ``json`` decorator and the\n``nocache`` decorator at the same time.\n\nDownload\n***********************", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/hexagonit.decorators", "keywords": "", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "hexagonit.decorators", "package_url": "https://pypi.org/project/hexagonit.decorators/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/hexagonit.decorators/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/hexagonit.decorators" }, "release_url": "https://pypi.org/project/hexagonit.decorators/0.2/", "requires_dist": null, "requires_python": null, "summary": "Collection of useful decorators for Zope development", "version": "0.2" }, "last_serial": 887012, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "675f6678e0eef5cce4dbde683959ea2a", "sha256": "e8b6e30b4d8d46b5170dedfdfcd2a60abb2824b260cc5ffa13a476095c70bc63" }, "downloads": -1, "filename": "hexagonit.decorators-0.1-py2.4.egg", "has_sig": false, "md5_digest": "675f6678e0eef5cce4dbde683959ea2a", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 7101, "upload_time": "2007-09-01T06:19:56", "url": "https://files.pythonhosted.org/packages/13/fe/dcfcfbe979dbbc2311737327e9092d7e1ccc10deba737c838a4bde6e4fd7/hexagonit.decorators-0.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "b1966c6c088770a823c9c3165e09ecba", "sha256": "69bcad240f43f9f3c0b85ffecb600f5cbc5f27f6ed92f39c3c9e19a61746dce1" }, "downloads": -1, "filename": "hexagonit.decorators-0.1.tar.gz", "has_sig": false, "md5_digest": "b1966c6c088770a823c9c3165e09ecba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3611, "upload_time": "2007-09-01T06:19:56", "url": "https://files.pythonhosted.org/packages/23/89/c15a3c8fbe5bcb9fc1796e570deecbff55c56cb7669630264af712711a19/hexagonit.decorators-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "4e4f39abd5b82c16a40d36c7618bb02e", "sha256": "7bb9e293647b43800141d74c27f502253d73c0377ca147170b7d4a334867b628" }, "downloads": -1, "filename": "hexagonit.decorators-0.2-py2.4.egg", "has_sig": false, "md5_digest": "4e4f39abd5b82c16a40d36c7618bb02e", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 8781, "upload_time": "2007-09-05T16:36:09", "url": "https://files.pythonhosted.org/packages/77/06/083285b913febe076ce46193e6acea04f356fda1652b8d3c39f53237e35a/hexagonit.decorators-0.2-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "047cc5e3bd82bc592b900e0dedb334ac", "sha256": "0f291f4feda092f8d2502dc6b19add3c93b5f7a4f4f966ccfe134bd434439727" }, "downloads": -1, "filename": "hexagonit.decorators-0.2.tar.gz", "has_sig": false, "md5_digest": "047cc5e3bd82bc592b900e0dedb334ac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4414, "upload_time": "2007-09-05T16:36:09", "url": "https://files.pythonhosted.org/packages/c5/63/c99c7d0eee2bd063b861ac54a1f2149d28a4be307d04d9ec357dd86a145d/hexagonit.decorators-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4e4f39abd5b82c16a40d36c7618bb02e", "sha256": "7bb9e293647b43800141d74c27f502253d73c0377ca147170b7d4a334867b628" }, "downloads": -1, "filename": "hexagonit.decorators-0.2-py2.4.egg", "has_sig": false, "md5_digest": "4e4f39abd5b82c16a40d36c7618bb02e", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 8781, "upload_time": "2007-09-05T16:36:09", "url": "https://files.pythonhosted.org/packages/77/06/083285b913febe076ce46193e6acea04f356fda1652b8d3c39f53237e35a/hexagonit.decorators-0.2-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "047cc5e3bd82bc592b900e0dedb334ac", "sha256": "0f291f4feda092f8d2502dc6b19add3c93b5f7a4f4f966ccfe134bd434439727" }, "downloads": -1, "filename": "hexagonit.decorators-0.2.tar.gz", "has_sig": false, "md5_digest": "047cc5e3bd82bc592b900e0dedb334ac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4414, "upload_time": "2007-09-05T16:36:09", "url": "https://files.pythonhosted.org/packages/c5/63/c99c7d0eee2bd063b861ac54a1f2149d28a4be307d04d9ec357dd86a145d/hexagonit.decorators-0.2.tar.gz" } ] }