Esempio n. 1
0
    def get_agendaitem_list(self):
        if self.model.has_agendaitem_list_document():
            agendaitem_list = self.model.agendaitem_list_document.resolve_document()
            agendaitem_list_modified = agendaitem_list.modified().asdatetime().astimezone(
                pytz.utc)

            if self.model.modified < agendaitem_list_modified:
                # Return current protocol
                return (u'{}.docx'.format(safe_unicode(agendaitem_list.Title())),
                        agendaitem_list.file.open())

        # Create new protocol
        operations = AgendaItemListOperations()
        command = CreateGeneratedDocumentCommand(
            self.context,
            self.model,
            operations,
            )

        filename = u'{}.docx'.format(operations.get_title(self.model))
        return (filename, StringIO(command.generate_file_data()))
Esempio n. 2
0
    def get_protocol(self):
        if self.model.has_protocol_document():
            protocol = self.model.protocol_document.resolve_document()
            protocol_modified = protocol.modified().asdatetime().astimezone(
                pytz.utc)

            if self.model.modified < protocol_modified:
                # Return current protocol
                return (u'{}.docx'.format(safe_unicode(protocol.Title())),
                        protocol.file.open())

        # Create new protocol
        operations = ProtocolOperations()
        command = CreateGeneratedDocumentCommand(
            self.context,
            self.model,
            operations,
            lock_document_after_creation=False)

        filename = u'{}.docx'.format(operations.get_title(self.model))
        return (filename, StringIO(command.generate_file_data()))
Esempio n. 3
0
    def get_agendaitem_list(self):
        if self.model.has_agendaitem_list_document():
            agendaitem_list = self.model.agendaitem_list_document.resolve_document()
            agendaitem_list_modified = agendaitem_list.modified().asdatetime().astimezone(
                pytz.utc)

            if self.model.modified < agendaitem_list_modified:
                # Return current protocol
                return (u'{}.docx'.format(safe_unicode(agendaitem_list.Title())),
                        agendaitem_list.file.open())

        # Create new protocol
        operations = AgendaItemListOperations()
        command = CreateGeneratedDocumentCommand(
            self.context,
            self.model,
            operations,
            )

        filename = u'{}.docx'.format(operations.get_title(self.model))
        return (filename, StringIO(command.generate_file_data()))