Ejemplo n.º 1
0
    def post(self, push_id):
        try:
            push = model.Push.get(push_id)
        except BadKeyError:
            raise HTTPStatusCode(httplib.NOT_FOUND)

        action = self.request.get('act')

        if action == 'sendtostage':
            stage = self.request.get('stage')
            logic.send_to_stage(push, stage)
            self.redirect(push.uri)

        elif action == 'sendtolive':
            logic.send_to_live(push)
            self.redirect(push.uri)

        elif action == 'abandon':
            logic.abandon_push(push)
            self.redirect('/pushes')

        elif action == 'take_ownership':
            logic.take_ownership(push)
            self.redirect(push.uri)

        else:
            raise HTTPStatusCode(httplib.BAD_REQUEST)
Ejemplo n.º 2
0
    def post(self, request_id):
        try:
            request = Request.get(request_id)
        except BadKeyError:
            raise HTTPStatusCode(httplib.NOT_FOUND)

        action = self.request.get('act')
        redirect_to_push = self.request.get('push') == 'true'

        if action == 'edit':
            subject = self.request.get('subject')
            assert len(subject) > 0, 'subject must have a value'
            message = self.request.get('message')
            branch = self.request.get('branch') or None
            target_date = self.request.get('target_date')
            target_date = datetime.datetime.strptime(target_date, '%Y-%m-%d').date() if target_date else None
            push_plans = self.request.get('push_plans', 'off')
            assert push_plans in ('on', 'off'), 'push plans must be on or off'
            urgent = self.request.get('urgent', 'off')
            assert urgent in ('on', 'off'), 'urgent must be on or off'
            js_serials = self.request.get('js_serials', 'off')
            assert js_serials in ('on', 'off'), 'js_serials must be on or off'
            img_serials = self.request.get('img_serials', 'off')
            assert img_serials in ('on', 'off'), 'img_serials must be on or off'
            tests_pass = self.request.get('tests_pass', 'off')
            assert tests_pass in ('on', 'off'), 'tests_pass must be on or off'
            tests_pass_url = self.request.get('tests_pass_url', '')
            time_to_verify = self.request.get('time_to_verify')
            logic.edit_request(
                request,
                subject=subject,
                message=message,
                push_plans=push_plans == 'on',
                urgent=urgent == 'on',
                js_serials=js_serials == 'on',
                img_serials=img_serials == 'on',
                tests_pass=(tests_pass == 'on'),
                tests_pass_url=tests_pass_url,
                target_date=target_date,
                branch=branch,
                time_to_verify=time_to_verify,
                )
            self.redirect(request.uri)

        elif action == 'accept':
            push_id = self.request.get('push')
            push = Push.get(push_id)
            logic.accept_request(push, request)
            self.redirect(push.uri)

        elif action == 'abandon':
            logic.abandon_request(request)
            self.redirect('/requests')

        elif action == 'withdraw':
            push_uri = request.push.uri if request.push else None
            logic.withdraw_request(request)
            self.redirect(push_uri if (redirect_to_push and push_uri) else request.uri)

        elif action == 'markcheckedin':
            push_uri = request.push.uri if request.push else None
            logic.set_request_checkedin(request)
            self.redirect(push_uri if (redirect_to_push and push_uri) else request.uri)

        elif action == 'marktested':
            push_uri = request.push.uri if request.push else None
            logic.set_request_tested(request)
            self.redirect(push_uri if (redirect_to_push and push_uri) else request.uri)

        elif action == 'take_ownership':
            push_uri = request.push.uri if request.push else None
            logic.take_ownership(request)
            self.redirect(push_uri if (redirect_to_push and push_uri) else request.uri)

        elif action == 'reject':
            reason = self.request.get('reason')
            push_uri = request.push.uri if request.push else None
            if not push_uri:
                push_uri = self.request.get('return_url')
            logic.reject_request(request, users.get_current_user(), reason)
            self.redirect(push_uri if (redirect_to_push and push_uri) else request.uri)
        
        else:
            raise HTTPStatusCode(httplib.BAD_REQUEST)