This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
pfwbged.collection/src/pfwbged/collection/multiactions.py

19 lines
789 B
Python

from Products.Five.browser import BrowserView
from plone import api
class MultiActionsView(BrowserView):
def __call__(self):
action = self.request.form['action'] # ex: process_without_comment
documents = self.request.form['documents[]']
if isinstance(documents, basestring):
documents = [documents]
for document_id in documents:
document = api.content.get(document_id)
api.content.transition(document, action)
document.reindexObject(idxs=['review_state'])
if action == 'to_process' and document.portal_type == 'dmsincomingmail':
from pfwbged.policy.subscribers.mail import incoming_mail_attributed
incoming_mail_attributed(document, u'')
return 'OK'