예제 #1
0
def force_live(push):
    for request in query.push_requests(push):
        request.state = 'live'

        request.put()
    push.bust_requests_cache()

    push.state = 'live'
    push.ltime = push.mtime

    push.put()
    
    return push
예제 #2
0
def abandon_push(push):
    assert push.state in ('accepting', 'onstage')

    push.state = 'abandoned'
    for request in query.push_requests(push):
        request.state = 'requested'
        request.push = None
        request.put()

    push.put()
    query.bust_request_caches()
    push.bust_requests_cache()

    return push
예제 #3
0
def send_to_live(push):
    assert push.state == 'onstage'
    requests = query.push_requests(push)
    for request in requests:
        assert request.state in ('tested', 'live')

    for request in requests:
        request.state = 'live'
        request.put()

    push.state = 'live'
    push.ltime = datetime.datetime.utcnow()

    push.put()
    push.bust_requests_cache()

    return push
예제 #4
0
파일: logic.py 프로젝트: Yelp/PushmasterApp
def set_request_tested(request, bust_caches=True):
    assert request.state == 'onstage'
    push = request.push
    assert push

    request.state = 'tested'
    request.put()

    if bust_caches:
        push.bust_requests_cache()

    push_owner_email = push.owner.email()

    util.send_mail(
        to=[push_owner_email, config.mail_to],
        subject='Re: %s: %s' % (request.owner.nickname(), request.subject),
        body='Looks good to me.\n' + config.url(push.uri))

    if all(request.state == 'tested' for request in query.push_requests(push)):
        util.send_im(push_owner_email, 'All changes for <a href="%s">the push</a> are verified on stage.' % config.url(push.uri))

    return request
예제 #5
0
파일: logic.py 프로젝트: Yelp/PushmasterApp
def send_to_stage(push, stage):
    assert push.state in ('accepting', 'onstage')
    assert stage in model.Push.all_stages

    checkedin_requests = query.push_requests(push, state='checkedin')
    if checkedin_requests:
        if push.state != 'onstage' or push.stage != stage:
            push.state = 'onstage'
            push.stage = stage

            push.put()
            query.bust_push_caches()

        for request in checkedin_requests:
            request.state = 'onstage'
            owner_email = request.owner.email()

            util.send_mail(
                to=[owner_email, config.mail_to],
                subject='Re: %s: %s' % (request.owner.nickname(), request.subject),
                body=('Please verify your changes on %s.\n%s' % (push.stage, config.url(push.uri)))
                )

            util.send_im(
                to=owner_email,
                message='<a href="mailto:%(pushmaster_email)s">%(pushmaster_name)s</a> requests that you verify your changes on %(stage)s for <a href="%(push_uri)s">%(request_subject)s</a>.',
                pushmaster_email=push.owner.email(),
                pushmaster_name=user_info(push.owner).full_name,
                request_subject=request.subject,
                push_uri=config.url(push.uri),
                stage=push.stage,
                )
            request.put()

        push.bust_requests_cache()

    return push