Beispiel #1
0
def report_issue(form, proxy=False):
    '''Report an issue, as a logged in user or anonymously.'''
    # /repos/:owner/:repo/issues
    path = 'repos/{0}'.format(REPO_URI)
    if proxy:
        return proxy_request('post', path,
                             data=json.dumps(build_formdata(form)))
    else:
        return github.post(path, build_formdata(form))
Beispiel #2
0
def report_issue(form, proxy=False):
    '''Report an issue, as a logged in user or anonymously.'''
    # /repos/:owner/:repo/issues
    path = 'repos/{0}'.format(REPO_URI)
    if proxy:
        return proxy_request('post', path,
                             data=json.dumps(build_formdata(form)))
    else:
        return github.post(path, build_formdata(form))
Beispiel #3
0
def report_issue(form, proxy=False):
    '''Report an issue, as a logged in user or anonymously.'''
    # /repos/:owner/:repo/issues
    path = 'repos/{0}'.format(REPO_URI)
    if proxy:
        # Return a Response object.
        response = proxy_request('post',
                                 path,
                                 data=json.dumps(build_formdata(form)))
        json_response = response.json()
    else:
        # Return JSON data as a dict
        json_response = github.post(path, build_formdata(form))
    return json_response
Beispiel #4
0
def new_issue():
    form = IssueForm(request.form)
    if request.method == 'GET':
        if g.user:
            user_info = github.get('user')
            return render_template('new_issue.html', form=form)
        else:
            return redirect(url_for('login'))
    elif request.method == 'POST' and form.validate():
        r = github.post('repos/' + app.config['ISSUES_REPO_URI'],
                        build_formdata(request.form))
        issue_number = r.get('number')
        return redirect(url_for('show_issue', number=issue_number))
    else:
        # Validation failed, re-render the form with the errors.
        return render_template('new_issue.html', form=form)
Beispiel #5
0
def report_issue(form, proxy=False):
    """Report an issue, as a logged in user or anonymously."""
    # /repos/:owner/:repo/issues
    path = 'repos/{0}'.format(REPO_URI)
    submit_type = form.get('submit_type')
    if proxy and submit_type == 'github-proxy-report':
        status_code, json_response = report_public_issue()
        if status_code == 201:
            report_private_issue(form, json_response.get('html_url'))
        else:
            abort(400)
    elif (not proxy) and submit_type == 'github-auth-report':
        # returns JSON data as a dict
        json_response = github.post(path, build_formdata(form))
    else:
        abort(400)
    return json_response
Beispiel #6
0
def report_issue(form, proxy=False):
    """Report an issue, as a logged in user or anonymously."""
    # /repos/:owner/:repo/issues
    path = 'repos/{0}'.format(REPO_URI)
    submit_type = form.get('submit_type')
    if proxy and submit_type == 'github-proxy-report':
        # Return a Response object.
        response = proxy_request('post',
                                 path,
                                 data=json.dumps(build_formdata(form)))
        json_response = response.json()
    elif (not proxy) and submit_type == 'github-auth-report':
        # Return JSON data as a dict
        json_response = github.post(path, build_formdata(form))
    else:
        abort(400)
    return json_response
Beispiel #7
0
def report_issue(form, proxy=False):
    """Report an issue, as a logged in user or anonymously."""
    # /repos/:owner/:repo/issues
    path = 'repos/{0}'.format(REPO_URI)
    submit_type = form.get('submit_type')
    if proxy and submit_type == 'github-proxy-report':
        # Return a Response object.
        response = proxy_request('post',
                                 path,
                                 data=json.dumps(build_formdata(form)))
        json_response = response.json()
    elif (not proxy) and submit_type == 'github-auth-report':
        # Return JSON data as a dict
        json_response = github.post(path, build_formdata(form))
    else:
        abort(400)
    return json_response
Beispiel #8
0
def report_issue(form):
    '''Report an issue, as a logged in user.'''
    return github.post('repos/{0}'.format(REPO_URI), build_formdata(form))
Beispiel #9
0
def report_issue(form):
    '''Report an issue, as a logged in user.'''
    return github.post('repos/{0}'.format(REPO_URI), build_formdata(form))
Beispiel #10
0
def report_issue(form):
    return github.post('repos/{0}'.format(URI), build_formdata(form))