Esempio n. 1
0
def register_model():
    """
    This funtion allow a user to submit a vtk 3D model.
    """
    if request.method == 'POST' and session["logged_in"] == True:
        user_id = session['user_id']
        file = request.files['model_file']

        dir_path = os.path.join(UPLOAD_FOLDER, str(session['user_id']))
        if not os.path.isdir(dir_path):
            os.makedirs(dir_path)
        path = os.path.join(dir_path,file.filename)

        if file and allowed_files(file.filename):
            filename = secure_filename(file.filename)
            file.save(path)

        model = VTKModels(
                    user_id,
                    request.form['model_title'],
                    request.form['model_description'],
                    request.form['model_dataset_type'],
                    path
                )

        db_session.add(model)
        db_session.commit()
    return redirect(url_for('main'))
Esempio n. 2
0
def register_user():
    if request.method == 'POST':
        user = User(request.form['name'], request.form['email'],
                    request.form['password'])
        db_session.add(user)
        db_session.commit()
        return redirect(url_for('login'))
    return render_template('register.html')
Esempio n. 3
0
def register_user():
    if request.method == 'POST':
        user = User(
                request.form['name'],
                request.form['email'],
                request.form['password']
                )
        db_session.add(user)
        db_session.commit()
        return redirect(url_for('login'))
    return render_template('register.html')
Esempio n. 4
0
def days_until_ssl_expiry_job(hostname):
    LOG.info('days_until_ssl_expiry_job')
    try:
        days_left = days_until_ssl_expiry(hostname)
    except gaierror as e:
        logging.error(f'Error processing job: {str(e)}')
        return

    # funky = 1 / 0  # TODO: ensure this gets to Sentry (import Sentry config at the top of this file?)

    LOG.info(f'{hostname} SSL has {days_left} days until expiry')
    domain_name = get_or_create(session=db_session, model=DomainName, domain_name=hostname)
    db_session.add(SSLCheck(domain_name=domain_name, days_until_ssl_expiry=days_left))
    db_session.commit()
Esempio n. 5
0
def register_model():
    """
    This funtion allow a user to submit a vtk 3D model.
    """
    if request.method == 'POST' and session["logged_in"] == True:
        user_id = session['user_id']
        file = request.files['model_file']

        dir_path = os.path.join(UPLOAD_FOLDER, str(session['user_id']))
        if not os.path.isdir(dir_path):
            os.makedirs(dir_path)
        path = os.path.join(dir_path, file.filename)

        if file and allowed_files(file.filename):
            filename = secure_filename(file.filename)
            file.save(path)

        model = VTKModels(user_id, request.form['model_title'],
                          request.form['model_description'],
                          request.form['model_dataset_type'], path)

        db_session.add(model)
        db_session.commit()
    return redirect(url_for('main'))