{ "info": { "author": "Mikko Ohtamaa", "author_email": "mikko@opensourcehacker.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Plone", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. contents::\n\nIntroduction\n====================\n\n``collective.scriptedredirect`` allows you to write HTTP 302 Moved Temporary and HTTP 301 Moved Permanently\nredirects for your `Plone CMS `_ site in Python code.\n\n.. image:: https://travis-ci.org/collective/collective.scriptedredirect.png\n\nBenefits\n====================\n\n* The redirect logic is front-end web server independent: no need to touch variouos configuration files of Apache, Varnish or Nginx)\n\n* Python allows to write more complex logic for redirects easier - no regular expressions!\n\n* Python scripts in Plone have access to more complete state information:\n user logged in status, permissions, etc.\n\nUsage\n====================\n\nInstallation\n----------------\n\nAdd add-on in *buildout.cfg*::\n\n eggs =\n ...\n collective.scriptedredirect\n\nRun buildout.\n\nInstall *Scripted redirects in Python* in Site Setup > Add-ons.\n\nDoing redirects through the web\n--------------------------------\n\nEdit *redirect_handler* in Zope Management Interface in your site root.\n\n.. image :: http://cloud.github.com/downloads/collective/collective.scriptedredirect/Screen%20Shot%202012-09-25%20at%201.28.18%20AM.png\n\nIn the case of accident use ``?no_redirect`` HTTP query parameter to override\nthe redirecter and fix your site.\n\n\nDoing redirects through the web\n--------------------------------\n\nYou can also register a browser view called ``redirect_handler``.\nIn this case, you write the redirect code in addon Python code\nand not through the web.\n\n``redirect_handler`` view is always preferred over ``redirect_handler`` script.\n\nExample Python code in ``redirector.py``::\n\n class TestingRedirectHandler(object):\n \"\"\" Redirect handler registered as a ``redirect_handler`` Zope 3 \n \"\"\"\n\n def __init__(self, context, request):\n self.context = context\n self.request = request\n\n def __call__(self, url, host, port, path):\n \"\"\"\n :return: None if no redirect needed, otherwise a string full HTTP URL to the redirect target\n\n :raise: zExceptions.Redirect or other custom redirect exception if needed\n \"\"\"\n\n # Simple example: always access site over www. domain prefix\n if not url.startswith(\"http://www.\"):\n return url.replace(\"http://\", \"http://www.\")\n\n # Don't redirect if we are already using www. prefix\n return None\n\nExample ZCML::\n\n \n\nInternals\n====================\n\n``collective.scriptedredirect`` hooks itself to Zope's pre-traversal hook and is\ntriggered before the request traverses into your Plone site in Zope application server.\n\nAuthor\n====================\n\nMikko Ohtamaa (`blog `_, `Facebook `_, `Twitter `_, `Google+ `_)\n\n\n\n\nChangelog\n=========\n\n\n1.1.1 (2013-04-14)\n------------------\n\n- Fixed .rst title levels for PyPi [miohtama]\n\n\n1.1 (2013-04-14)\n----------------\n\n- Added redirects via browser view support [miohtama]\n\n- Testing, Travis CI support [miohtama]\n\n\n1.0\n----------------\n\n- Initial development [miohtama]", "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.scriptedredirect", "keywords": "", "license": "gpl", "maintainer": null, "maintainer_email": null, "name": "collective.scriptedredirect", "package_url": "https://pypi.org/project/collective.scriptedredirect/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/collective.scriptedredirect/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/collective/collective.scriptedredirect" }, "release_url": "https://pypi.org/project/collective.scriptedredirect/1.1.1/", "requires_dist": null, "requires_python": null, "summary": "Write redirects in Python for Plone CMS", "version": "1.1.1" }, "last_serial": 788186, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "0719aa86da3c4a78246b5cf2387f5c61", "sha256": "31ce4a14cce9e990e6ea9fed314bedc8b9cd76da832894a73ff36be879473555" }, "downloads": -1, "filename": "collective.scriptedredirect-1.0.zip", "has_sig": false, "md5_digest": "0719aa86da3c4a78246b5cf2387f5c61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26093, "upload_time": "2013-02-05T13:12:23", "url": "https://files.pythonhosted.org/packages/f6/6d/b5fb086ca7bb339be3f10231a4cc5713a74ac7d5602cf619287ac5f710a4/collective.scriptedredirect-1.0.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "aeb5e406febbd115f1a5dc008eed22e5", "sha256": "70867d7ce89a3f52930173c0529b168e4303fc7e026cff91f317366f9abb1885" }, "downloads": -1, "filename": "collective.scriptedredirect-1.1.zip", "has_sig": false, "md5_digest": "aeb5e406febbd115f1a5dc008eed22e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36319, "upload_time": "2013-04-14T11:19:35", "url": "https://files.pythonhosted.org/packages/d2/ff/aa54065ce2dcf2a937004d5a4c9aa41f19a671717562c0b38768de25e5fb/collective.scriptedredirect-1.1.zip" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "c1a9c2e01e4213ecd7a54857152fb456", "sha256": "03868027e960ce508c6c9c08e140b3f6b7b4b7768280735450ae6685fdac1345" }, "downloads": -1, "filename": "collective.scriptedredirect-1.1.1.zip", "has_sig": false, "md5_digest": "c1a9c2e01e4213ecd7a54857152fb456", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36808, "upload_time": "2013-04-14T11:25:19", "url": "https://files.pythonhosted.org/packages/fb/ea/42594eb3176bc285c59f969c905fea15f220c144cd1cfbbae27cb6b7f95b/collective.scriptedredirect-1.1.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c1a9c2e01e4213ecd7a54857152fb456", "sha256": "03868027e960ce508c6c9c08e140b3f6b7b4b7768280735450ae6685fdac1345" }, "downloads": -1, "filename": "collective.scriptedredirect-1.1.1.zip", "has_sig": false, "md5_digest": "c1a9c2e01e4213ecd7a54857152fb456", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36808, "upload_time": "2013-04-14T11:25:19", "url": "https://files.pythonhosted.org/packages/fb/ea/42594eb3176bc285c59f969c905fea15f220c144cd1cfbbae27cb6b7f95b/collective.scriptedredirect-1.1.1.zip" } ] }