style thème sombre.
[Plinn.git] / skins / custom_control / folder_bottom_control.py
1 ##parameters=ids, **kw
2 ##
3
4 #TODO : translate messages
5 #from Products.PlacelessTranslationService.MessageID import MessageIDFactory
6 #_ = MessageIDFactory('default', as_unicode=True)
7 _ = lambda x : lambda : x
8
9 subset_ids = [ obj.getId() for obj in context.listFolderContents() ]
10 try:
11 try:
12 attempt = context.moveObjectsToBottom(ids, subset_ids=subset_ids)
13 except TypeError:
14 # Zope 2.7.0
15 attempt = context.moveObjectsToBottom(ids)
16 if attempt:
17 msg = _(attempt == 1 and \
18 '%d item moved to bottom.' or \
19 '%d items moved to bottom.')().encode('utf-8') % attempt
20 return context.setStatus( True, msg)
21 else:
22 return context.setStatus(False, 'Nothing to change.')
23 except ValueError, errmsg:
24 return context.setStatus(False, 'ValueError: %s' % errmsg)