My Plone is 4.x and Python 2.7.
I create a Template, see the snippet:
tal:define="path_list here/getPhysicalPath;
path python:'/'.join(path_list);
pathdepth viewletOptions/path/depth | python:-1;
highlighted python:here.portal_catalog(path={'query':path,'depth':pathdepth}
,portal_type='News Item'
,review_state='highlight'
,sort_on='effective'
,sort_order='reverse'
,hasImage=True)[:4];
oldnew python:here.portal_catalog(path={'query':path,'depth':pathdepth}
,portal_type='News Item'
,review_state=['highlight','published']
,sort_on='effective'
,sort_order='reverse')[5:7];">
I have two list highlighted 'n oldnew, and I tried creating a script (python) in ZMI very simple
for i in highlighted:
if i in oldnew:
oldnew.remove(i)
return oldnew
And raised a error
TypeError: mybrains.__cmp__(x,y) requires y to be a 'mybrains', not a 'Acquisition.ImplicitAcquisitionWrapper'
How can I remove the same NewsItens of highlighted in oldnew?
As you have several workflows assigned for items, this cannot be achieved using a ZMI-script, because you'll get "Insufficient Privileges" when trying to access the several workflow-states, due to restricted Python.
Instead use a browser-view and include these helper-methods for getting the desired items: