def handleApply(self, action): data, errors = self.extractData() if errors: return agenda_items_to_include = [] for agenda_item in self.get_agenda_items(): if agenda_item.name in self.request: agenda_items_to_include.append(agenda_item) if not agenda_items_to_include: raise (ActionExecutionError( Invalid(_(u"Please select at least one agenda item.")))) operations = ManualExcerptOperations( agenda_items_to_include, data['title'], include_initial_position=data['include_initial_position'], include_legal_basis=data['include_legal_basis'], include_considerations=data['include_considerations'], include_proposed_action=data['include_proposed_action'], include_discussion=data['include_discussion'], include_decision=data['include_decision'], include_publish_in=data['include_publish_in'], include_disclose_to=data['include_disclose_to'], include_copy_for_attention=data['include_copy_for_attention']) command = CreateGeneratedDocumentCommand(data['dossier'], self.model, operations) command.execute() command.show_message() return self.redirect_to_meeting()
def __call__(self): meeting = self.get_meeting() command = CreateGeneratedDocumentCommand( self.context, meeting, self.operations, ) try: command.execute() command.show_message() except AgendaItemListMissingTemplate: msg = _( u'msg_error_agendaitem_list_missing_template', default=(u'There is no agendaitem list template configured, agendaitem list could not be generated.'), mapping=dict(title=meeting.get_title()), ) api.portal.show_message(msg, self.request, type='error') except AgendaItemListAlreadyGenerated: msg = _( u'msg_error_agendaitem_list_already_generated', default=(u'The agenda item list for meeting ${title} has already been generated.'), mapping=dict(title=meeting.get_title()), ) api.portal.show_message(msg, self.request, type='error') except SablonProcessingFailed: msg = _(u'Error while processing Sablon template') api.portal.show_message(msg, self.request, type='error') return self.request.RESPONSE.redirect(meeting.get_url())
def handleApply(self, action): data, errors = self.extractData() if errors: return agenda_items_to_include = [] for agenda_item in self.get_agenda_items(): if agenda_item.name in self.request: agenda_items_to_include.append(agenda_item) if not agenda_items_to_include: raise(ActionExecutionError( Invalid(_(u"Please select at least one agenda item.")))) operations = ManualExcerptOperations( agenda_items_to_include, data['title'], include_initial_position=data['include_initial_position'], include_legal_basis=data['include_legal_basis'], include_considerations=data['include_considerations'], include_proposed_action=data['include_proposed_action'], include_discussion=data['include_discussion'], include_decision=data['include_decision'], include_publish_in=data['include_publish_in'], include_disclose_to=data['include_disclose_to'], include_copy_for_attention=data['include_copy_for_attention']) command = CreateGeneratedDocumentCommand( data['dossier'], self.model, operations) command.execute() command.show_message() return self.redirect_to_meeting()
def generate_agenda_item_list(self, meeting): if isinstance(meeting, MeetingWrapper): meeting = meeting.model from opengever.meeting.command import AgendaItemListOperations from opengever.meeting.command import CreateGeneratedDocumentCommand command = CreateGeneratedDocumentCommand( meeting.get_dossier(), meeting, AgendaItemListOperations(), ) command.execute()
def render(self): meeting = self.get_meeting() command = CreateGeneratedDocumentCommand( self.context, meeting, self.operations, lock_document_after_creation=True) try: command.execute() command.show_message() except ProtocolAlreadyGenerated: msg = _(u'msg_error_protocol_already_generated', default=u'The protocol for meeting ${title} has already ' u'been generated.', mapping=dict(title=meeting.get_title())) api.portal.show_message(msg, self.request, type='error') return self.request.RESPONSE.redirect(meeting.get_url())
def __call__(self): meeting = self.get_meeting() command = CreateGeneratedDocumentCommand( self.context, meeting, self.operations, lock_document_after_creation=True) try: command.execute() command.show_message() except ProtocolAlreadyGenerated: msg = _(u'msg_error_protocol_already_generated', default=u'The protocol for meeting ${title} has already ' u'been generated.', mapping=dict(title=meeting.get_title())) api.portal.show_message(msg, self.request, type='error') return self.request.RESPONSE.redirect(meeting.get_url())