{ "info": { "author": "Asko Soukka", "author_email": "asko.soukka@iki.fi", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python" ], "description": "Implement your script in some module shipping in your package as a named\r\nfunction accepting context and request as its arguments:\r\n\r\n.. code:: python\r\n\r\n def whoami(context, request):\r\n from AccessControl.SecurityManagement import getSecurityManager\r\n user = getSecurityManager().getUser()\r\n return {\r\n 'absolute_url': context.absolute_url(),\r\n 'context': context.__repr__(),\r\n 'user': user.__repr__(),\r\n 'getId': user.getId(),\r\n 'getUserName': user.getUserName(),\r\n 'getRoles': user.getRoles(),\r\n 'getRolesInContext': user.getRolesInContext(context)\r\n }\r\n\r\nRemember to include transaction commit when your scripts modifies the\r\ndatabase (the example above does not):\r\n\r\n.. code:: python\r\n\r\n import transaction\r\n transaction.commit()\r\n\r\nRegister your function as a named set'uptools entry point for\r\n*collective.runhook** in your package's **setup.py**:\r\n\r\n.. code:: python\r\n\r\n from setuptools import setup\r\n\r\n setup(\r\n # ...\r\n entry_points=\"\"\"\r\n # -*- Entry points: -*-\r\n # ...\r\n [collective.runhook]\r\n whoami = my.package:whoami\r\n \"\"\"\r\n )\r\n\r\nAdd **collective.runhook** as a dependency of your package, or include it in\r\nyour buildout's instance part:\r\n\r\n.. code:: ini\r\n\r\n [buildout]\r\n parts = instance\r\n # ...\r\n\r\n [instance]\r\n recipe = plone.recipe.zope2instance\r\n # ...\r\n eggs =\r\n Plone\r\n # ...\r\n collective.runhook\r\n\r\nRun the buildout and execute your script:\r\n\r\n.. code:: bash\r\n\r\n $ bin/instance runhook whoami\r\n ...\r\n {'absolute_url': 'http://nohost/Plone',\r\n 'context': '',\r\n 'getId': None,\r\n 'getRoles': ('manage', 'Authenticated'),\r\n 'getRolesInContext': ['manage', 'Authenticated'],\r\n 'getUserName': 'System Processes',\r\n 'user': \"\"}\r\n\r\n**collective.runhook** obeys the same instance script arguments as\r\nthe run command:\r\n\r\n.. code:: bash\r\n\r\n $ bin/instance -OPlone runhook whoami\r\n ...\r\n {'absolute_url': 'http://nohost/Plone',\r\n 'context': '',\r\n 'getId': None,\r\n 'getRoles': ('manage', 'Authenticated'),\r\n 'getRolesInContext': ['manage', 'Authenticated'],\r\n 'getUserName': 'System Processes',\r\n 'user': \"\"}\r\n\r\nAs a bonus, **collective.runhook** can authenticate the script as any existing\r\nuser given with ``ZOPE_USER`` environment variable (but be aware that the\r\nauthentication is only done after ``-O``-traverse):\r\n\r\n.. code:: bash\r\n\r\n $ ZOPE_USER=datakurre bin/instance -OPlone runhook whoami\r\n ...\r\n {'absolute_url': 'http://nohost/Plone',\r\n 'context': '',\r\n 'getId': 'datakurre',\r\n 'getRoles': ['Member', 'Reviewer', 'Site Administrator', 'Authenticated'],\r\n 'getRolesInContext': ['Member',\r\n 'Reviewer',\r\n 'Site Administrator',\r\n 'Authenticated'],\r\n 'getUserName': 'datakurre',\r\n 'user': \"\"}\r\n\r\nAnd we do support URLs with VirtualHostBase:\r\n\r\n.. code:: bash\r\n\r\n $ ZOPE_USER=datakurre bin/instance -O/VirtualHostBase/http://example.com:80/Plone/VirtualHostRoot/Plone runhook whoami\r\n ...\r\n {'absolute_url': 'http://example.com',\r\n 'context': '',\r\n 'getId': 'datakurre',\r\n 'getRoles': ['Member', 'Reviewer', 'Site Administrator', 'Authenticated'],\r\n 'getRolesInContext': ['Member',\r\n 'Reviewer',\r\n 'Site Administrator',\r\n 'Authenticated'],\r\n 'getUserName': 'datakurre',\r\n 'user': \"\"}\r\n\r\nChangelog\r\n=========\r\n\r\n0.9.5 (2014-09-28)\r\n------------------\r\n\r\n- Fix to iterate through all entrypoints with the same name to support multiple\r\n scripts with the same hook name\r\n [datakurre]\r\n- Fix to pprint script return value to not require script to print by itself\r\n [datakurre]\r\n\r\n0.9.4 (2014-09-26)\r\n------------------\r\n\r\n- Fix to print hooks' results (when non-False)\r\n [datakurre]\r\n\r\n0.9.3 (2014-09-25)\r\n------------------\r\n\r\n- Add support for VirtualHostMonster URLs\r\n [datakurre]\r\n\r\n0.9.2 (2014-09-25)\r\n------------------\r\n\r\n- Fix issue where wrong attribute from entrypoint was read\r\n [datakurre]\r\n\r\n0.9.1 (2014-09-24)\r\n------------------\r\n\r\n- Update README\r\n [datakurre]\r\n\r\n0.9.0 (2014-09-24)\r\n------------------\r\n\r\n- First release.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/collective/collective.runhook/", "keywords": "", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "collective.runhook", "package_url": "https://pypi.org/project/collective.runhook/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/collective.runhook/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/collective/collective.runhook/" }, "release_url": "https://pypi.org/project/collective.runhook/0.9.5/", "requires_dist": null, "requires_python": null, "summary": "Named instance run script entry points for plone.recipe.zope2instance", "version": "0.9.5" }, "last_serial": 1242991, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "a650dd975b4fc115f7cab84715b10272", "sha256": "11db61d0e2438bad0234cc28730a0a875485f46ab6b11dcbeac713ed537de9fd" }, "downloads": -1, "filename": "collective.runhook-0.9.0.zip", "has_sig": false, "md5_digest": "a650dd975b4fc115f7cab84715b10272", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14049, "upload_time": "2014-09-24T16:01:45", "url": "https://files.pythonhosted.org/packages/99/c0/149b5d8157d20142e6254d315c5fb546da45837107ae659166922a379a50/collective.runhook-0.9.0.zip" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "8c442ae2ee24f4d98bd2b1e46733f9cd", "sha256": "560053aa3cdb3b95c41dd499d4a8a4e4c7ad6acc3b468e8485c9a675a7cee01e" }, "downloads": -1, "filename": "collective.runhook-0.9.1.zip", "has_sig": false, "md5_digest": "8c442ae2ee24f4d98bd2b1e46733f9cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14247, "upload_time": "2014-09-24T19:05:20", "url": "https://files.pythonhosted.org/packages/61/41/d232b7643db8e0d63e695e09a8ad0f4c12c11cf28e80d9bdbc72d8530d54/collective.runhook-0.9.1.zip" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "7e8afa6a1788bab423de9b1b2a78eaf4", "sha256": "54504cd6dc518f19b54610400aee5b0a9d5b8b31a3aa821d0737e23f578df32b" }, "downloads": -1, "filename": "collective.runhook-0.9.2.zip", "has_sig": false, "md5_digest": "7e8afa6a1788bab423de9b1b2a78eaf4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14424, "upload_time": "2014-09-25T09:41:57", "url": "https://files.pythonhosted.org/packages/85/0b/e6ee931ba8063ddfe1da514a5af3377436d2acb9c1e43407b774fb068d47/collective.runhook-0.9.2.zip" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "de6f65306db85bfce7142bb7b0e88150", "sha256": "61513158740479e4a29a038a6cf57f7b4f9feba2e537c187aa467b5286d2acac" }, "downloads": -1, "filename": "collective.runhook-0.9.3.zip", "has_sig": false, "md5_digest": "de6f65306db85bfce7142bb7b0e88150", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14941, "upload_time": "2014-09-25T12:43:38", "url": "https://files.pythonhosted.org/packages/5f/64/fc24589403e9aa35275d3c540a54d52c635706786dee7ce748ab15dc7f1b/collective.runhook-0.9.3.zip" } ], "0.9.4": [ { "comment_text": "", "digests": { "md5": "d31c75bb4bd29c3144633d9b7333908d", "sha256": "424840ede2247527f2f097f4bd51ba3e4f910daa21d5feb415cc07e1a71d398e" }, "downloads": -1, "filename": "collective.runhook-0.9.4.zip", "has_sig": false, "md5_digest": "d31c75bb4bd29c3144633d9b7333908d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15101, "upload_time": "2014-09-26T13:15:46", "url": "https://files.pythonhosted.org/packages/d4/9a/87cacbf82f7bfeab5310533e670302af04ab6fd05271f08a703e4ec6e3d8/collective.runhook-0.9.4.zip" } ], "0.9.5": [ { "comment_text": "", "digests": { "md5": "a492f221f46723bec682da36eb500cb1", "sha256": "3cd3f1620f9739ff312dd0884795a0a0b2e83970e32d144639a0a1b4c280365b" }, "downloads": -1, "filename": "collective.runhook-0.9.5.zip", "has_sig": false, "md5_digest": "a492f221f46723bec682da36eb500cb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15320, "upload_time": "2014-09-27T22:34:20", "url": "https://files.pythonhosted.org/packages/db/96/75e8921ff7438249883577664cd15299157913942a98893eabe6492ffce6/collective.runhook-0.9.5.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a492f221f46723bec682da36eb500cb1", "sha256": "3cd3f1620f9739ff312dd0884795a0a0b2e83970e32d144639a0a1b4c280365b" }, "downloads": -1, "filename": "collective.runhook-0.9.5.zip", "has_sig": false, "md5_digest": "a492f221f46723bec682da36eb500cb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15320, "upload_time": "2014-09-27T22:34:20", "url": "https://files.pythonhosted.org/packages/db/96/75e8921ff7438249883577664cd15299157913942a98893eabe6492ffce6/collective.runhook-0.9.5.zip" } ] }