[Zope-CMF] Compound elements status

Max M maxm@mxm.dk
Tue, 19 Mar 2002 11:18:42 +0000


seb bacon wrote:

>I think this topic could do with more discussion before anything gets
>folded into the CMF.
>

Agreed!

>The CMFArticle is a specific application of a composite-type idea, viz.
>the user can add elements to a folder which aggregates them all together
>for display in a single page.
>

I strongly disagrre with the idea that all of the elements should be put 
into a folder. What if you want your compound document to be a folder? 
Then you would have all kind of strange little objetcs inside it.

Also if the elements is put inside a folder there will have to be 
security checks etc. on them all. That sucks too.

I believe it would be a better idea to have the elements stored directly 
in a "content" list inside the compund element. That way it will also be 
trivial to change the order of the elements. And for the security 
system, and the catalog it is all seen as one item.

It will also make it pretty easy to make new elements, as there will be 
practically no "Zope'ism" to the new elements.

Something like this below.

regards Max M

###########################################

class Element:

    def __str__(self):
        return 'all the content as a string'

    def html(self):
        return '<div>all the content as a string</div>'

class Compound:

    def __init__(self):
        self._content = []

    def append(self, item)
        self.content.append()

    def __str__(self):
        return '\n'.join([str(element) for element in self._content])

    principiaSearchSource = __str__

    def html(self):
        return '\n'.join([element.html() for element in self._content])