by Martin Aspeli <email@example.com> based on work by Helge Tesdal (RedirectionTool) and Whit Morriss (topp.rose).
Bring dead links back to life! plone.app.redirector knows where your content used to be and can bring you to its new location when content moves.
This component expects you to register storage.RedirectionStorage as a local utility providing IRedirectionStorage (CMFPlone does this). Once that’s done, the subscribers in subscribers.py will listen for object moved and object deleted events.
When an object is moved (renamed or cut/pasted into a different location), the redirection storage will remember the old path. It is smart enough to deal with transitive references (if we have a -> b and then add b -> c, it is replaced by a reference a -> c) and circular references (attempting to add a -> a does nothing).
When an object is deleted, all references to it are deleted as well.
The view in browser.py contains methods (used in Plone’s default_error_message.pt when it gets a NotFound error) that do the following:
- attempt to redirect from the assumed intended path to the new path of an object, if the redirection storage holds a reference from the old path.
- if not, look for the first valid parent of the assumed intended path, and present it as an option to the user
- further, use the last id of the assumed intended path and attempt to search for objects in the catalog that contain this, presenting the options to the user
- Import object events from zope.lifecycleevent. [davisagli]
- Move tests from PloneTestCase to plone.app.testing. [timo]
- Support parts of views e.g. mypage/@@myview/somepart [anthonygerrard]
- #12354 will redirect based on the query string as well as path if query_string stored. [djay]
- #9967 will append the same query string after redirecting to be more tracker friendly. [djay]
- #12858 first suggestion on not found page can be unsuitable [anthonygerrard]
1.1.2 - 2011-07-05
- Don’t break in the objectMoved handler if the request has no ACTUAL_URL, to facilitate testing. [davisagli]
- Add MANIFEST.in. [WouterVH]
1.1.1 - 2011-03-02
- Gracefully handle errors parsing the SearchableText query on the 404 view. [davisagli]
1.1 - 2010-07-18
- Update license to GPL version 2 only. [hannosch]
1.0.13 - 2010-01-25
- Added optional support for the getRedirectionAllowedForTypes method of Products.RedirectionTool. [hannosch]
1.0.12 - 2009-06-17
- Fix bad calling convention in IFourOhFourView definition. [wichert]
- Move event subscribers to a separate zcml file so they can easily be excluded. [wichert]
- Update browser view to handle environments where the storage utility is not availbale. [wichert]
1.0.11 - 2009-04-05
- Fixed multiple steps circular references #8840 [gotcha]
- Fixed a bug which caused URLs with %-escaped sequences to grow extra %25s upon redirect. [erikrose]
1.0.10 - 2009-03-07
- Fixed tests to be independent of any default content. [hannosch]
- Fixed a test to be less dependent on the page rendering. [hannosch]
- Added quotation marks around open and close parens. This fixes http://dev.plone.org/plone/ticket/8588. [MatthewWilkes]
1.0.9 - 2008-07-07
- Fix for the fix regarding unnecessary creation of redirection entries for newly created objects. [witsch]
1.0.8 - 2008-07-07
- Fix release confusion by ensuring we have a “late” version number. Somewhere, someone created a 1.0.7. :-) [optilude]
1.0.6 - 2008-07-07
- Fix unnecessary creation of redirection entries for newly created objects. [witsch]
1.0.5 - 2008-01-03
- Start searches for missing items in the navigation root instead of the site root. [wichert]
1.0.2 - 2007-10-08
- also ignore ids from views. [ldr]
- Added __iter__ function to storage which iterates over all paths. [fschulze]
1.0 - 2007-08-17
- Initial release. [optilude]