Пример #1
0
def create_issue():
    # copy the form so we can add the full UA string to it.
    form = request.form.copy()
    # see https://github.com/webcompat/webcompat.com/issues/688
    spamlist = ['facebook', 'fb.com']
    for spam in spamlist:
        if spam in form.get('url'):
            msg = (u'Anonymous reporting for Facebook.com is temporarily '
                   'disabled. Please see https://github.com/webcompat/we'
                   'bcompat.com/issues/688 for more details.')
            flash(msg, 'notimeout')
            return redirect(url_for('index'))
    form['ua_header'] = request.headers.get('User-Agent')
    # Do we have an image ready to be uploaded?
    image = request.files['image']
    if image:
        form['image_upload'] = json.loads(upload()[0])
    if form.get('submit-type') == AUTH_REPORT:
        if g.user:  # If you're already authed, submit the bug.
            response = report_issue(form)
            return redirect(url_for('thanks',
                            number=response.get('number')))
        else:  # Stash form data into session, go do GitHub auth
            session['form_data'] = form
            return redirect(url_for('login'))
    elif form.get('submit-type') == PROXY_REPORT:
        response = report_issue(form, proxy=True).json()
        return redirect(url_for('thanks', number=response.get('number')))
Пример #2
0
def create_issue():
    # copy the form so we can add the full UA string to it.
    form = request.form.copy()
    form['ua_header'] = request.headers.get('User-Agent')
    # Do we have an image or screenshot ready to be uploaded?
    if ((request.files['image'] and request.files['image'].filename) or
       request.form.get('screenshot')):
        form['image_upload'] = json.loads(upload()[0])
    if form.get('submit-type') == AUTH_REPORT:
        if g.user:  # If you're already authed, submit the bug.
            response = report_issue(form)
            return thanks_page(request, response)
        else:  # Stash form data into session, go do GitHub auth
            session['form_data'] = form
            return redirect(url_for('login'))
    elif form.get('submit-type') == PROXY_REPORT:
        response = report_issue(form, proxy=True).json()
        return thanks_page(request, response)
Пример #3
0
def create_issue():
    # copy the form so we can add the full UA string to it.
    form = request.form.copy()
    form['ua_header'] = request.headers.get('User-Agent')
    # Do we have an image or screenshot ready to be uploaded?
    if ((request.files['image'] and request.files['image'].filename)
            or request.form.get('screenshot')):
        form['image_upload'] = json.loads(upload()[0])
    if form.get('submit-type') == AUTH_REPORT:
        if g.user:  # If you're already authed, submit the bug.
            response = report_issue(form)
            return thanks_page(request, response)
        else:  # Stash form data into session, go do GitHub auth
            session['form_data'] = form
            return redirect(url_for('login'))
    elif form.get('submit-type') == PROXY_REPORT:
        response = report_issue(form, proxy=True).json()
        return thanks_page(request, response)