[Zope-dev] Re: Zope 2.7: OrderSupport for ObjectManager

Chris McDonough chrism@zope.com
06 May 2003 09:47:14 -0400


Hi Yuppie...

On Tue, 2003-05-06 at 06:20, Yuppie wrote:
> Well, you could use 'orderObjects' for that use case if you write some 
> code that does the necessary manipulation after each insertion. But we 
> included it for another use case:
> 
> Sometimes people want to maintain a user-specific order, but want to 
> start from a sorted order. E.g. if most sub-objects should be ordered by 
> 'title', but some special sub-objects should be at top of the container.

So you mean that someone's usage of it would go like this:

- Add an ordered folder "O" and change its sort attr to "title"

- Add a bunch of subobjects to "O".

- Apply sorting.

- Move stuff up and down.

Is that about right?

> I like your ideas of "IndexedFolder". And there are the two methods 
> 'getDefaultSorting' and 'setDefaultSorting' in OrderSupport that do 
> something similar in a very basic way.

I suspect these method signatures would need to change if we were to use
an index and an arbitrary sort function.

> > This might be an argument to ditch the dynamic sorting feature until we
> > better understand the use cases.  That said, the feature isn't exposed
> > in the mgmt interface, so it might be ok.  But if people come to rely on
> > it, it will be difficult to remove (and will never ever go away).
> 
> AFAICS, 'orderObjects' would still be useful for the use case described 
> above. 'getDefaultSorting' and 'setDefaultSorting' provide a small 
> subset of the API you propose and should play well with any "IndexedFolder".

While I see what you're saying, I think anticipating an API is a bit
speculative.

Anyway, all of this is just advisory, but at very least, I'd like to see
the "apply current sorting" button go away in the UI because it's not
entirely clear what it does to someone who doesn't understand the code. 
If you can't investigate the sorting parameters TTW, you probably
shouldn't be able to activate them TTW.

- C