Hello. We have been dealing with portlets management in CPS 3.4.2 and we
notice that when a portlet has the 'slot_override' option selected and
the 'visibility_range' as 'Just un this folder' (coded in [0,1]), it
overrides quite well the former portlets (p.e. Document portlet,
Contents portlet, etc) with the 'disable_override' option unselected IN
THE SAME folder, but it still overrides those portlets in the
subfolders. 

We thought that this behaviour wasn't ok, and we have fixed it in the
method 'getPortlets' of PortletsTool.py (CPSPortlets) as follow:

def getPortlets()
...
        # portlet override
        if override:
            for portlet in allportlets:
                # the portlet is protected
                if portlet.disable_override:
                    continue
                
                depth = portlet.getDepth()
                # run through the slot's portlets to see whether one of
them
                # can override this portlet.
                for pt in allportlets:
                    # portlets cannot override themselves
                    if pt is portlet:
                        continue
                    # the portlet does not do override
                    if not pt.slot_override:
                        continue
                    if pt.getDepth() <= depth:
                        continue  
# THIS IS WHAT WE HAVE ADDED                                    
#################################
                    if pt.visibility_range == [0,1] and context !=
pt.aq_parent.aq_parent:
                        continue
#################################
                    # override the portlet
                    remove_list.append(portlet)
                    break
...


It checks if the visibility_range of the overriding portlet correspond
with the context of the overrided portlet.
Now it works fine.

Do you think it worths to be an update for CPSPortlets?
_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to