[Zope-dev] Re: Zope 2.7: OrderSupport for ObjectManager
Yuppie
schubbe@web.de
Wed, 07 May 2003 15:20:45 +0200
Hi Lennart!
Lennart Regebro wrote:
> That means that the question of this being a replacement or a mixin is
> mostly a question of replacing the main.dtml or having a separate tab.
> As the code is now, OrderedFolder is using a replacement manage_main
> taken from OrderSupport. OrderSupport doesn't have a manage_main, so it
> will acquire it, but I assume this is just a temporary ommision, and
> that OrderSupport is supposed to have a specialized 'ordered_main.dtml'.
> It would in that case be no problems in supplying a management tag that
> only supplies ordering too, of you need ordering mixin, but can't
> override manage_main.
Ok. It isn't obvious what we did with manage_main:
Quoting myself:
> 3.) For the ZMI, we use the same 'main.dtml' as the ObjectManager. This way we avoid redundant code and make it easier for products that need to change the 'main.dtml'.
The only reason OrderSupport has its own manage_options is that
OrderSupport has its own help file. main.dtml has some sections like:
<dtml-if hasOrderSupport>
...
</dtml-if>
We couldn't find a way to do something similar with the help file.
I'm not sure if I did get your destinction between mixin and replacement.
> The last question, as I understand it, is if the mixin should really be
> just a mixin where you not only order keys, but supply a storage for
> what should be ordered, so that the mixin has no ordering by itself, but
> instead order other sets. It would indeed be possible to do this, if
> these sets implement a standard ordering interface, for example the one
> above, or the simple ordering interface of being a list.
>
> It can be done, and quite simply, by replacing the references to
> self._objects with a call to a method, like this one:
>
> def getOrderStorage(self):
> return self._objects
>
> You could then override this getOrderStorage() method with whatever you
> want in your object, and get it to point to whatever. In this case, the
> order storage must be a list.
>
>
>
> Is this what you have been discussing, or have I misunderstood something?
I guess the main point is to have an implementation that allows to add
or remove OrderSupport and IndexSupport like a local service, without
changing the Folder class itself. But Magnus should better know if you
did get his point.
Cheers,
Yuppie