{ "info": { "author": "Ross Patterson", "author_email": "me@rpatterson.net", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. -*-doctest-*-\r\n\r\n===================\r\ncollective.redirect\r\n===================\r\n\r\nAdminister redirects to internal or external URLs using Link like\r\ncontent. Where Products.redirectiontool or plone.app.redirector only\r\ndeal with redirecting to internal URLs internal to the portal,\r\ncollective.redirect allows for redirecting to external URLs. The\r\npaths to redirect are administered using instances of the Redirect\r\ncontent type. The paths that are redirected are independent of the\r\npath of the Redirect instance for a couple of reasons.\r\n\r\nFirstly, since the portal object is not a BTree based folder it will\r\nbegin to behave poorly if too many objects are added to it. Allowing\r\nthe redirected paths independent from the location of the Redirect\r\ninstances allows for many redirects without putting too many objects\r\nin the portal root.\r\n\r\nSecondly, having the paths independent of the Redirect instance\r\nlocations allows users to create redirect for paths that they can't\r\nadd content too. Keep in mind that this might be a bad thing for your\r\nsite and can certainly be abused as a DOS attack of sorts.\r\n\r\nIf multiple redirects exist for the same path, the one with the more\r\nrecent publication date will be preferred. Finally a redirect will\r\nnever override an otherwise traversable URL. IOW, a redirect cannot\r\noverride an actual content object, skin object, view, or anything else\r\ntraversal. The redirect only occurs when a NotFound error would\r\notherwise be raised.\r\n\r\nUse a browser.\r\n\r\n >>> from Products.Five import testbrowser\r\n >>> browser = testbrowser.Browser()\r\n >>> portal.error_log._ignored_exceptions = ()\r\n >>> portal_url = portal.absolute_url()\r\n\r\nBefore a redirect is added, going to a non-existent URL will return\r\nthe 404 page.\r\n\r\n >>> browser.open(portal_url+'/foo')\r\n Traceback (most recent call last):\r\n HTTPError: HTTP Error 404: Not Found\r\n \r\n >>> browser.open(portal_url+'/bar')\r\n Traceback (most recent call last):\r\n HTTPError: HTTP Error 404: Not Found\r\n \r\nOpen another browser and login as a user who can add Redirects.\r\n\r\n >>> from Products.PloneTestCase import ptc\r\n >>> member_browser = testbrowser.Browser()\r\n >>> member_browser.handleErrors = False\r\n >>> member_browser.open(portal.absolute_url())\r\n >>> member_browser.getLink('Log in').click()\r\n >>> member_browser.getControl(\r\n ... 'Login Name').value = ptc.default_user\r\n >>> member_browser.getControl(\r\n ... 'Password').value = ptc.default_password\r\n >>> member_browser.getControl('Log in').click()\r\n >>> member_browser.open(portal_url+'/Members/test_user_1_')\r\n\r\nAdd a redirect. Set the \"Local Path\" field to the path that should be\r\nredirected from. The local path is always rooted at the portal. Set\r\nthe \"URL\" field to the URL that should be redirected to.\r\n\r\n >>> member_browser.getLink(url='createObject?type_name=Redirect').click()\r\n >>> member_browser.getControl('Title').value = 'Foo Redirect Title'\r\n >>> member_browser.getControl('Local Path').value = '/foo'\r\n >>> member_browser.getControl('URL').value = '/plone/events'\r\n >>> member_browser.getControl('Save').click()\r\n >>> print member_browser.contents\r\n <...\r\n ...Changes saved...\r\n ...Foo Redirect Title...\r\n ...Local Path...\r\n .../foo...\r\n ...URL...\r\n .../events...\r\n\r\nWhen the redirect is not accessible to the user visiting the local\r\npath, such as when the workflow of the redirect forbids it, the\r\nredirect will not occur.\r\n\r\n >>> foo_redirect = portal.Members.test_user_1_['foo-redirect-title']\r\n >>> portal.portal_workflow.getInfoFor(\r\n ... foo_redirect, 'review_state')\r\n 'private'\r\n >>> browser.open(portal_url+'/foo')\r\n Traceback (most recent call last):\r\n HTTPError: HTTP Error 404: Not Found\r\n \r\nOnce the redirect is accessible, the user visiting the local path is\r\nredirected to the remote URL.\r\n\r\n >>> self.loginAsPortalOwner()\r\n >>> portal.portal_workflow.doActionFor(foo_redirect, 'publish')\r\n >>> self.logout()\r\n\r\nUse a VHM style URL to simulate a virtual hosting environment.\r\n\r\n >>> browser.open('http://nohost/VirtualHostBase/http/nohost'\r\n ... '/VirtualHostRoot/plone/foo/')\r\n >>> browser.url\r\n 'http://nohost/plone/events'\r\n\r\nA local path that has no redirect still returns the 404 page.\r\n\r\n >>> browser.open(portal_url+'/bar')\r\n Traceback (most recent call last):\r\n HTTPError: HTTP Error 404: Not Found\r\n\r\nChangelog\r\n=========\r\n\r\n0.5 - 2010-11-10\r\n----------------\r\n\r\n* Local paths with two or more non-existent segments didn't work,\r\n because traversal stopped at the first non-existent segment and then\r\n request.URL would return this truncated path, so that no match would\r\n result when querying the catalog. Changed the view to use ACTUAL_URL\r\n instead, which does return the actual URL used.\r\n\r\n0.4 - 2009-06-03\r\n----------------\r\n\r\n* The fallback to plone's standard_error_message was AQ wrapped in the\r\n plone_templates skin folder so that skin precedence was being\r\n ignored which, for example, didn't allow for overriding\r\n default_error_message\r\n\r\n0.3 - 2008-11-14\r\n----------------\r\n\r\n* Add support for VHM\r\n\r\n0.2 - 2008-11-12\r\n----------------\r\n\r\n* Remove accidental commit from development\r\n\r\n0.1 - 2008-11-11\r\n----------------\r\n\r\n* Initial release", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/collective.redirect", "keywords": "", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "collective.redirect", "package_url": "https://pypi.org/project/collective.redirect/", "platform": "", "project_url": "https://pypi.org/project/collective.redirect/", "project_urls": { "Homepage": "http://pypi.python.org/pypi/collective.redirect" }, "release_url": "https://pypi.org/project/collective.redirect/0.5/", "requires_dist": null, "requires_python": null, "summary": "Administer redirects to internal or external URLs using Link like content", "version": "0.5" }, "last_serial": 845327, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "acace4a63228e7ca7b411bdbe90a6c11", "sha256": "2138f53eb75bf78660db0735f9e37641283dca1b39bfb58528e34966884293e4" }, "downloads": -1, "filename": "collective.redirect-0.1.tar.gz", "has_sig": false, "md5_digest": "acace4a63228e7ca7b411bdbe90a6c11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6730, "upload_time": "2008-11-12T04:54:35", "url": "https://files.pythonhosted.org/packages/e1/61/64d15d20b8a3924c15f5a66693f375b564dc00e651d82cd2ac7497299f56/collective.redirect-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "e6bef0bff21dc7f80f117df2255a15de", "sha256": "77fc8dd64a3e2cfe77635e9b39cfd74b88bf44d0c2b056b32fe28aed11363cf8" }, "downloads": -1, "filename": "collective.redirect-0.2.tar.gz", "has_sig": false, "md5_digest": "e6bef0bff21dc7f80f117df2255a15de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6760, "upload_time": "2008-11-12T21:14:42", "url": "https://files.pythonhosted.org/packages/67/e7/c0c4c3c94661160e1ad1b70e080722d1a17439bcd64f6bec89467e51e280/collective.redirect-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "f53e3f1c3f62dc4a2e8c04079138fc2e", "sha256": "69726ed2b5287a1347afa23f045df0fd713f84d80b8e61d03736d6420a7f7c56" }, "downloads": -1, "filename": "collective.redirect-0.3.tar.gz", "has_sig": false, "md5_digest": "f53e3f1c3f62dc4a2e8c04079138fc2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7182, "upload_time": "2008-11-14T22:28:19", "url": "https://files.pythonhosted.org/packages/9e/6a/391c962643044826e308854d3644502b90c85c3575244333bb2acb85c2db/collective.redirect-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "66d509c89bbccfd6cc755cd943ca1421", "sha256": "291b5aafd1478dfef101065385278b41d439f59522e6aa5da67319c293630199" }, "downloads": -1, "filename": "collective.redirect-0.4.tar.gz", "has_sig": false, "md5_digest": "66d509c89bbccfd6cc755cd943ca1421", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7319, "upload_time": "2009-06-03T19:43:58", "url": "https://files.pythonhosted.org/packages/cd/e8/f653a667d32ad1cbec33c98051cb500463df4261b33a50fbf625aa09b279/collective.redirect-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "14d91ed432920823cdb351eec6f919f6", "sha256": "85d900e421c1ca431aa39dfb8945f8ddb5f1af27e83e5472b0803d6efee47527" }, "downloads": -1, "filename": "collective.redirect-0.5.tar.gz", "has_sig": false, "md5_digest": "14d91ed432920823cdb351eec6f919f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7099, "upload_time": "2010-11-11T06:52:43", "url": "https://files.pythonhosted.org/packages/e6/20/ddb8bc72d9d18947f2dea9c8973a13b0bd36d83604e4be79e72378ee344d/collective.redirect-0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "14d91ed432920823cdb351eec6f919f6", "sha256": "85d900e421c1ca431aa39dfb8945f8ddb5f1af27e83e5472b0803d6efee47527" }, "downloads": -1, "filename": "collective.redirect-0.5.tar.gz", "has_sig": false, "md5_digest": "14d91ed432920823cdb351eec6f919f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7099, "upload_time": "2010-11-11T06:52:43", "url": "https://files.pythonhosted.org/packages/e6/20/ddb8bc72d9d18947f2dea9c8973a13b0bd36d83604e4be79e72378ee344d/collective.redirect-0.5.tar.gz" } ] }