예제 #1
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
예제 #2
0
    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