Godefroid Chapelle wrote:
I think this can cause performance problems so I want to obtain the list of elements to filter in the context of the composite page and then pass this list to the viewlets as a preset variable.

I am afraid there is no way to do that with the current code.

You'd need to change some code.

http://svn.plone.org/svn/CompositePack/branches/1.1/composite/archetype.py

   def renderInline(self):
        """Returns a representation of this object as a string.
        """
        obj = self.dereference()
        # First we check if the current user has View permission of this
        # object. If not we return an empty string.
        mtool = getToolByName(self, 'portal_membership')
        if not mtool.checkPermission('View', obj):
            return ''
        template = self.template()
        if template is not None:
            if obj is not None:
                # Rewrap the template to give it the right context
                template = aq_base(template).__of__(obj)
            slot = aq_parent(aq_inner(self))
            slots = aq_parent(aq_inner(slot))
            composite = aq_parent(aq_inner(slots))
            viewlet = self.getCurrentViewlet()

# This is where stuff happens.

            return template(composite=composite, slots=slots, slot=slot,
                viewlet=viewlet)
        # No viewlet, try to call the object
        if safe_callable(obj):
            return obj()
        return str(obj)


thanks, Godefroid; I have finished what I need it! here is the code I used, in case somebody has a similar problem: http://julius.jornada.com.mx/browser/code/skins/LaJornadaLite/skins/lajornadalite_templates/getSectionItems.py

I think it wouldn't be very expensive, but I want to make sure on what happens with CacheFu and Navigation Page in this case.

currently we use the following script to check out if the navigation page has changed:

slots = context.cp_container.filled_slots
tag = 0
for slot in slots.objectValues():
    tag += int(slot.bobobase_modification_time())
return str(tag)

I don't know what a Smart Folder will return in this case.

saludos y gracias

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

Reply via email to