Esempio n. 1
0
def submit_archive():
    form = ArchiveSubmit()
    if form.validate_on_submit():
        process_submission(form)
        return redirect(url_for('ui.index'))
    elif request.method == 'POST':
        flash_errors(form)
    return render_template(
        'submit_archive.html', form=form, groups=SUBMISSION_GROUPS.keys())
Esempio n. 2
0
def submit_artifact(group):
    form = SUBMISSION_FORMS.get(group, ArtifactSubmit)()
    if form.validate_on_submit():
        process_submission(form, group)
        return redirect(url_for('ui.index'))
    elif request.method == 'POST':
        flash_errors(form)
    return render_template(
        'submit_artifact.html', form=form, group=group)
Esempio n. 3
0
    form = RegistrationForm()

    if form.validate_on_submit():
        try:
            username = form.username.data
            password = form.password.data
            email = form.email.data.strip()

            if len(email) == 0:
                email = None

            create_user(username, password, email)
            login(username, password)

            flash('Registration successful, welcome %s!' % (username),
                  category='info')
            return redirect(url_for('ui.index'))
        except ValidationError, ve:
            invalids = ','.join([f.title() for f in ve.errors.keys()])
            msg = 'Invalid: %s' % (invalids)
            flash(escape(msg), category='error')
        except ValueError, ve:
            flash(escape(ve.message), category='error')
        except Exception, ex:
            current_app.logger.info(ex)
            flash('An unknown error has occured.', category='error')
    else:
        flash_errors(form)

    return render_template('register.html', form=form)