Miguel Sánchez Beato a écrit :
> 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
>

This behavior is logical in its way and we have some sites relying
on it.

> we have fixed it in the
> method 'getPortlets' of PortletsTool.py (CPSPortlets) as follow:
> 

That's great. And thank you for sharing it.

We would rather have a property in the cpsportlets tool that triggers
your additional code. Thus the current default behavior would not be
modified while still providing your new feature.

Could you please create an enhancement (not defect) ticket in trac ?

Then you can commit your change along with the new property.

A unit test testing the new feature would also be appreciated since
we are planning to add a new caching mechanism in the portlet lookup
cf. http://svn.nuxeo.org/trac/pub/ticket/1800


> 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.
> 


Cheers,

-- 
Marc-Aurèle DARCHE
Open Source Enterprise Content Management (ECM)   http://www.nuxeo.org/
NUXEO (Paris, France)                             http://nuxeo.com/

_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to