{ "info": { "author": "Wichert Akkerman", "author_email": "wichert@wiggy.net", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Zope2", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Programming Language :: Python" ], "description": "Note\n====\n\nThis package is provided for backwards compatibility. New code should use the\npublication events introduced in Zope 2.12 directly.\n\nFor Zope 2.10, a backport of the publication events is available in\n`ZPublisherEventsBackport`_. This is required for this package and may be added\nto your buildout directly, or by specifying the 'Zope2.10' extra::\n\n eggs =\n Plone\n plone.postpublicationhook [Zope2.10]\n\nIntroduction\n============\n\nThis package provides a hook into Zope's ZPublisher that is run after the\npublisher has completed publication, but before the the transaction is committed\nand the response is returned to the requesting browser. This is practical for\ncaching purposes: it is the ideal place to determine and insert caching headers\ninto the response.\n\nHooks use `zope.event`_'s event mechanism using the\nplone.validatehook.interfaces.IPostValidationEvent. This is based on the\nstandard ObjectEvent from `zope.component`_.\n\nExample\n=======\n\nAs an example we will write a bit of code which logs the path of every published\nobject. This is the code for the event handler::\n\n from zope.interface import Interface\n from zope.component import adapter\n from plone.postpublicationhook.interfaces import IAfterPublicationEvent\n import logging\n\n logger = logging.getLogger(\"LogRequest\")\n\n @adapter(Interface, IAfterPublicationEvent)\n def LogRequest(object, event):\n if getattr(object, \"getPhysicalPath\", None) is None:\n path=\"Unknown path\"\n else:\n path=\"/\".join(object.getPhysicalPath()\n\n logger.info(\"Request for object %s\" % path)\n\n\nTo use this code you need to register it in zcml::\n\n \n\nUsing ZPublisher events directly\n================================\n\nThe IPubBeforeCommit event is equivalent to the IAfterPublicationEvent,\nhowever it is not an ObjectEvent so there are a few changes::\n\n from zope.component import adapter\n from ZPublisher.interfaces import IPubBeforeCommit\n import logging\n\n logger = logging.getLogger(\"LogRequest\")\n\n @adapter(IPubBeforeCommit)\n def LogRequest(event):\n request = event.request\n object = request['PUBLISHED']\n if getattr(object, \"getPhysicalPath\", None) is None:\n path=\"Unknown path\"\n else:\n path=\"/\".join(object.getPhysicalPath()\n\n logger.info(\"Request for object %s\" % path)\n\n\nRegister it in zcml the same way::\n\n \n\n.. _zope.event: http://pypi.python.org/pypi/zope.event\n.. _zope.component: http://pypi.python.org/pypi/zope.component\n.. _ZPublisherEventsBackport: http://pypi.python.org/pypi/ZPublisherEventsBackport\n\nChangelog\n=========\n\n1.1 - 2010-06-08\n----------------\n\n* General and metadata cleanup.\n [hannosch]\n\n* Refactor to use ZPublisher publication events (available in Zope 2.10 with\n ZPublisherEventsBackport.)\n [lrowe]\n\n1.0rc1 - 2008-10-15\n-------------------\n\n* Initial release\n [wichert]", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "", "license": "ZPL", "maintainer": null, "maintainer_email": null, "name": "plone.postpublicationhook", "package_url": "https://pypi.org/project/plone.postpublicationhook/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/plone.postpublicationhook/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/plone.postpublicationhook/1.1/", "requires_dist": null, "requires_python": null, "summary": "Zope 2 post-publication hook", "version": "1.1" }, "last_serial": 796410, "releases": { "1.0rc1": [ { "comment_text": "", "digests": { "md5": "862f39d6f3fb0be3a01db42eb4e6cecd", "sha256": "28e92f866eccc8d658639305811c4c8af1a7d57b96a6dab4a49e8585a7e959b4" }, "downloads": -1, "filename": "plone.postpublicationhook-1.0rc1.zip", "has_sig": false, "md5_digest": "862f39d6f3fb0be3a01db42eb4e6cecd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10918, "upload_time": "2008-10-15T08:09:20", "url": "https://files.pythonhosted.org/packages/71/f7/0915af15dea6042f92c63bd05938d6a1af6870dc60bb528f578a701f125d/plone.postpublicationhook-1.0rc1.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "a6dc8132da3153a2d439abb972db3c9e", "sha256": "6a8b7f217cfdcbe181efe14be08579587bf7be8b81ed90295f067a4689b6fb09" }, "downloads": -1, "filename": "plone.postpublicationhook-1.1.zip", "has_sig": false, "md5_digest": "a6dc8132da3153a2d439abb972db3c9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10457, "upload_time": "2010-06-08T21:09:50", "url": "https://files.pythonhosted.org/packages/90/16/57a5a38e1c89058abcef0b4c8a0cff8c9a09ebd7f356fe3ea1c5b9c8fc06/plone.postpublicationhook-1.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a6dc8132da3153a2d439abb972db3c9e", "sha256": "6a8b7f217cfdcbe181efe14be08579587bf7be8b81ed90295f067a4689b6fb09" }, "downloads": -1, "filename": "plone.postpublicationhook-1.1.zip", "has_sig": false, "md5_digest": "a6dc8132da3153a2d439abb972db3c9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10457, "upload_time": "2010-06-08T21:09:50", "url": "https://files.pythonhosted.org/packages/90/16/57a5a38e1c89058abcef0b4c8a0cff8c9a09ebd7f356fe3ea1c5b9c8fc06/plone.postpublicationhook-1.1.zip" } ] }