コード例 #1
0
ファイル: timeline.py プロジェクト: uniteddiversity/indico
    def _process(self, action, comment):
        argmap = {'tags': EditingTagsField(self.event, missing=set())}
        if action in (EditingReviewAction.update,
                      EditingReviewAction.update_accept):
            argmap['files'] = EditingFilesField(self.event,
                                                self.contrib,
                                                self.editable_type,
                                                allow_claimed_files=True,
                                                required=True)
        args = parser.parse(argmap, unknown=EXCLUDE)
        service_url = editing_settings.get(self.event, 'service_url')

        new_revision = review_editable_revision(self.revision, session.user,
                                                action, comment, args['tags'],
                                                args.get('files'))

        publish = True
        if service_url:
            try:
                resp = service_handle_review_editable(self.editable,
                                                      session.user, action,
                                                      self.revision,
                                                      new_revision)
                publish = resp.get('publish', True)
            except ServiceRequestFailed:
                raise ServiceUnavailable(
                    _('Failed processing review, please try again later.'))

        if publish and action in (EditingReviewAction.accept,
                                  EditingReviewAction.update_accept):
            publish_editable_revision(new_revision or self.revision)
        return '', 204
コード例 #2
0
    def _process(self):
        args = parser.parse({
            'files': EditingFilesField(self.event, self.contrib, allow_claimed_files=True, required=True)
        })

        create_submitter_revision(self.revision, session.user, args['files'])
        return '', 204
コード例 #3
0
ファイル: timeline.py プロジェクト: uniteddiversity/indico
    def _process(self):
        if self.editable:
            raise UserValueError(_('Editable already exists'))

        args = parser.parse({
            'files':
            EditingFilesField(self.event,
                              self.contrib,
                              self.editable_type,
                              required=True)
        })
        service_url = editing_settings.get(self.event, 'service_url')
        initial_state = InitialRevisionState.new if service_url else InitialRevisionState.ready_for_review

        editable = create_new_editable(self.contrib, self.editable_type,
                                       session.user, args['files'],
                                       initial_state)
        if service_url:
            try:
                service_handle_new_editable(editable, session.user)
            except ServiceRequestFailed:
                raise ServiceUnavailable(
                    _('Submission failed, please try again later.'))

        return '', 201
コード例 #4
0
    def _process(self, comment):
        args = parser.parse({
            'files': EditingFilesField(self.event, self.contrib, allow_claimed_files=True, required=True)
        })

        replace_revision(self.revision, session.user, comment, args['files'])
        return '', 204
コード例 #5
0
 def _process(self, action, comment):
     argmap = {'tags': EditingTagsField(self.event, missing=set())}
     if action == EditingReviewAction.update:
         argmap['files'] = EditingFilesField(self.event, self.contrib, allow_claimed_files=True, required=True)
     args = parser.parse(argmap)
     review_editable_revision(self.revision, session.user, action, comment, args['tags'], args.get('files'))
     return '', 204
コード例 #6
0
    def _process(self, comment, state):
        args = parser.parse({
            'tags': EditingTagsField(self.event, allow_system_tags=self.is_service_call, missing=set()),
            'files': EditingFilesField(self.event, self.contrib, self.editable_type, allow_claimed_files=True,
                                       required=True)
        })

        user = User.get_system_user() if self.is_service_call else session.user
        replace_revision(self.revision, user, comment, args['files'], args['tags'], state)
        return '', 204
コード例 #7
0
    def _process(self):
        if self.editable:
            raise UserValueError(_('Editable already exists'))

        args = parser.parse({
            'files': EditingFilesField(self.event, self.contrib, required=True)
        })

        create_new_editable(self.contrib, self.editable_type, session.user, args['files'])
        return '', 201
コード例 #8
0
ファイル: timeline.py プロジェクト: pvshingala1997/indico
    def _process(self):
        args = parser.parse({
            'files': EditingFilesField(self.event, self.contrib, self.editable_type, allow_claimed_files=True,
                                       required=True)
        })

        service_url = editing_settings.get(self.event, 'service_url')
        new_revision = create_submitter_revision(self.revision, session.user, args['files'])

        if service_url:
            try:
                service_handle_review_editable(self.editable, session.user, EditingReviewAction.update,
                                               self.revision, new_revision)
            except ServiceRequestFailed:
                raise ServiceUnavailable(_('Failed processing review, please try again later.'))
        return '', 204