#241: Clean up auto-sort, auto-order code

Contents
  1. Motivation
  2. Assumptions
  3. Proposal
  4. Implementation
  5. Deliverables
  6. Risks
  7. Progress log
  8. Participants
by Andreas Zeidler last modified Jan 21, 2010 07:28 AM

Clean up, i.e. remove all code related to auto-sorting / auto-ordering folder contents as this feature was implemented for Plone 2.1, but never got enabled. Basically this proposes to revert http://plone.org/products/atcontenttypes/roadmap/3

Proposed by
Andreas Zeidler
Proposal type
User interface, Architecture
Assigned to release
Repository branch
plip241-auto-sort-cleanup
State
completed

Motivation

Plone has come a long way and grown a lot of features doing so. This has also lead to a rather big code base, parts of which are unmaintained or even not used at all anymore. One such feature is the capability to automatically sort a folder's contents whenever a new item is added, changed or removed from the folder. The order can be set persistently on a per-folder basis.

However, while this seemed to be a desirable feature at the time, it was never quite completed, or perhaps just never activated. Longer-standing Plone contributors might be able to give more insight here.

As the code hasn't been changed significantly since the feature was put in place and there doesn't seem to be much demand for it either, this PLIP proposes to remove all related code. This would not only significantly slim down the code base, but also reduce complexity thereby making efforts like the folder unification much easier to implement and maintain long-term.

Assumptions

There are no pending plans to revive the auto-sorting feature.

Proposal

Recursively remove all code related to auto-sorting of folder contents as well as its otherwise unused dependencies. This also includes interfaces and tests.

Implementation

Starting at ATContentTypes/lib/autosort.py(164)manage_afterAdd() the commented out call should be removed, after which tools such as pyflakes can be used to recursively remove all unused code.

Deliverables

Versions of CMFPlone, ATContentTypes and Archetypes with all code related to auto-sorting removed. Local branches and notes about which parts need to be removed exist.

Risks

  • Existing Plone installations have modified the above mentioned manage_afterAdd method to enable the auto-sorting feature. Removing the code would break such installations on upgrade. Since enabling the feature cannot be done by just changing Plone's configuration, but does require local code changes, the number of sites using it is probably very low.
  • Existing 3rd-party products might be relying on parts of the code or interfaces to be removed and would therefore break during an upgrade of Plone.
  • However, being completely disabled clearly means the feature is currently unsupported, so while the above mentioned breakages are of course undesirable, they would not violate the goals for 3.x releases.

Progress log

The clean-up has been done on the above mentioned branch of ATContentTypes. A review bundle is provided at http://svn.plone.org/svn/plone/review/plip241-auto-sort-cleanup/

Participants

Andreas Zeidler

Comments (7)

Martijn Pieters Oct 26, 2008 05:06 PM
+1
Danny Bloemendaal Oct 27, 2008 03:56 PM
+1
Andreas Zeidler Oct 27, 2008 09:45 PM
abstaining as i proposed this PLIP myself
Tom Lazar Oct 28, 2008 10:36 AM
+1 perhaps my favourite plip of all ;-)
Tom Lazar Jan 24, 2009 11:53 AM
Looking at the final diff (i.e. via http://dev.plone.org/collec[…]ts%2FATContentTypes%4076963) I can't find anything objectionable in the implementation of this PLIP. So +1 from me, too.
Tom Lazar Jan 24, 2009 11:58 AM
btw, re: http://dev.plone.org/collective/changeset/79241 it seems advisable to look into the manage_renameObject method of Products.Archetypes.OrderedBaseFolder.OrderedBaseFolder to see whether some code can be removed from, so that this PLIP can end up with even less code ;)
Martijn Pieters Jan 25, 2009 12:20 PM
On the whole the cleanup looks fine to me.

I do wonder about http://dev.plone.org/collective/changeset/79241
though; Products.Archetypes.OrderedBaseFolder.OrderedBaseFolder does
the same thing apart from the re-index, so you can remove most of the
method in ATContentTypes.

Otherwise this has my +1.

A next step (not necessarily for this PLIP) would be to move that test
in CMFPlone mentioned in r79241 to be moved to ATContentTypes, or both
test and the re-index to be moved to Archetypes, if it is appropriate
there.