Back to index

plone3  3.1.7
folder_top_control.py
Go to the documentation of this file.
00001 ##parameters=ids, **kw
00002 ##
00003 from Products.CMFDefault.utils import Message as _
00004 
00005 subset_ids = [ obj.getId() for obj in context.listFolderContents() ]
00006 try:
00007     attempt = context.moveObjectsToTop(ids, subset_ids=subset_ids)
00008     if attempt == 1:
00009         return context.setStatus(True, _(u'Item moved to top.'))
00010     elif attempt > 1:
00011         return context.setStatus(True, _(u'Items moved to top.'))
00012     else:
00013         return context.setStatus(False, _(u'Nothing to change.'))
00014 except ValueError:
00015     return context.setStatus(False, _(u'ValueError: Move failed.'))