Hi,

On 17 April 2010 06:38, Giovanni Toffoli <[email protected]> wrote:
> I investigated a bit more the problem of ordering contents in the content
> view and summary view of a workspace (borg.project), and found a solution to
> it. Not sure it is a clean solution, but it works for me. I hope that the
> package owners can check it and add it to next release.
>
> In borg.project.content.py, modify the declaration line of the class
> Project, and add 3 lines, as follows:
>
> from OFS.IOrderSupport import IOrderedContainer
> from Products.Archetypes.OrderedBaseFolder import OrderedContainer

borg.projcet does *not* use Archetypes. Mixing anything Archetypes
related into it is a very bad idea.

There is, however, an OrderedFolder in OFS which you may be able to use instead.

> # class Project(Container):
> class Project(Container, OrderedContainer):
>   __implements__  = (IOrderedContainer)
>
> Some explanations follow.
> Deriving from OrderedContainer is enough to be able to change the position
> of a content inside the container, by dragging the 4-points handle: the
> method getObjPositionInParent of a content item returns a correctly updated
> value.
> But the index getObjPositionInParent is built based on the helper method
> getObjPositionInParent in CatalogTool, a so called "indexable object
> wrapper".
> In Plone 3.1.7 the latter method always returns 0 (zero) if the container
> doesn't provide the IOrderedContainer interface.
> It seems that in Plone 3.3.5 the code line "__implements__  =
> (IOrderedContainer)" no more is needed, since the helper method in
> CatalogTool has changed slightly.

I'd suggest upgrading to Plone 3.3 at least, where this should be a
bit more sane and you shouldn't need the __implements__ line.

> References:
> - see class OrderedContainer in Products.Archetypes.OrderedBaseFolder.py
> - see helper method getObjPositionInParent in
> Products.CMFPlone.CatalogTool.py
>

Martin

_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to