(u, p, hid)
return render_template('delete_hook.html',
        project=p,
        hook=h
    )
Delete an existing service hook.
Delete an existing service hook.
Delete an existing service hook .
def delete_hook(u, p, hid):
    """
    Delete an existing service hook.
    """
    h = Hook.query.get(hid)
    if not h:
        # Project doesn't exist (404 Not Found)
        return abort(404)

    if p.owner.id != g.user.id or h.project.id != p.id:
        # Project isn't public and the viewer isn't the project owner.
        # (403 Forbidden)
        return abort(403)

    if request.method == 'POST' and request.form.get('do') == 'd':
        p.hooks.remove(h)
        db.session.delete(h)
        db.session.commit()
        return redirect(url_for('.details', p=p.name, u=u.username))

    return render_template('delete_hook.html',
        project=p,
        hook=h
    )
def delete_hook ( u , p , hid ) : h = Hook . query . get ( hid ) if not h : # Project doesn't exist (404 Not Found) return abort ( 404 ) if p . owner . id != g . user . id or h . project . id != p . id : # Project isn't public and the viewer isn't the project owner. # (403 Forbidden) return abort ( 403 ) if request . method == 'POST' and request . form . get ( 'do' ) == 'd' : p . hooks . remove ( h ) db . session . delete ( h ) db . session . commit ( ) return redirect ( url_for ( '.details' , p = p . name , u = u . username ) ) return render_template ( 'delete_hook.html' , project = p , hook = h )