How to use the template.LayoutHelper function in template

To help you get started, we’ve selected a few template examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github saurabhshri / ccextractor-web / mod_dashboard / controller.py View on Github external
parameter = CCExtractorParameters.query.filter(CCExtractorParameters.parameter == ccextractor_parameters_form.parameter.data).first()
        if parameter is not None:
            flash('CCExtractor parameter with the commit already exists. Id = {id}'.format(id=parameter.id), 'error')
        else:
            parameter = CCExtractorParameters(ccextractor_parameters_form.parameter.data,
                                              ccextractor_parameters_form.description.data,
                                              ccextractor_parameters_form.requires_value.data,
                                              ccextractor_parameters_form.enabled.data)
            db.session.add(parameter)
            db.session.commit()
            update_cmd_json(parameter, "new")
            log.debug('New CCExtractor parameter added. [{ccx}]'.format(ccx=parameter.id))
            flash('CCExtractor parameter added!', 'success')

    details = DetailsForTemplate(g.user.id, admin_dashboard=True)
    layout = LayoutHelper(logged_in=True, details=details)
    return render_template('mod_dashboard/dashboard.html',
                           layout=layout.get_entries(),
                           details=details,
                           ccextractor_parameters_form=ccextractor_parameters_form,
                           ccextractor_form=ccextractor_form)
github saurabhshri / ccextractor-web / mod_auth / controller.py View on Github external
if form.validate_on_submit():
                    user = Users(email=email,
                                 password=form.password.data,
                                 name=form.name.data)
                    db.session.add(user)
                    db.session.commit()

                    resp = send_signup_confirmation_mail(user.email)
                    if resp.status_code is not 200:
                        from run import log
                        log.debug("Mail sending failed. Check mail logs.")

                    user_log.debug("Sign Up Complete for : {email} | User ID: {user_id}".format(email=user.email, user_id=user.id))
                    flash('Signup Complete! Please Login to continue.', 'success')
                else:
                    layout = LayoutHelper(logged_in=False)
                    return render_template("mod_auth/signup-verification.html", form=form, email=email, layout=layout.get_entries())
            else:
                flash('Email is already registered!', 'error')
            return redirect(url_for('.login'))

        flash('Verification failed! Incorrect email address/verification code. Please try again.', 'error-message')
    else:
        flash('The verification link is expired. Please try again.', 'error-message')

    return redirect(url_for('.signup'))
github saurabhshri / ccextractor-web / mod_auth / controller.py View on Github external
if form.validate_on_submit():
        user = Users.query.filter_by(email=form.email.data).first()
        if user and user.is_password_valid(form.password.data):
            session['user_id'] = user.id
            user_log.debug('[User: {user_id}] logged in from IP: {ip}'.format(user_id=user.id, ip=request.remote_addr))
            if len(redirect_location) == 0:
                return redirect(url_for('mod_dashboard.dashboard'))
            else:
                return redirect(url_for(redirect_location))
        else:
            flash('Wrong username or password', 'error')
            user_log.warning('Invalid login attempt from IP: {ip} for email :{email}'.format(email=form.email.data, ip=request.remote_addr))

        return redirect(url_for('.login'))
    layout = LayoutHelper(logged_in=False)
    return render_template("mod_auth/login.html", form=form, layout=layout.get_entries(), next=redirect_location)
github saurabhshri / ccextractor-web / run.py View on Github external
def internal_server_error_handler(e):
    """
    Handles the 500 error and displays a template.
    """
    if g.user is not None:
        details = DetailsForTemplate(g.user.id, admin_dashboard=False)
        layout = LayoutHelper(logged_in=True, details=details)
    else:
        layout = LayoutHelper(logged_in=False)
    return render_template('500.html', layout=layout.get_entries()), 500
github saurabhshri / ccextractor-web / mod_dashboard / controller.py View on Github external
def admin_uploaded_files():
    details = DetailsForTemplate(g.user.id, admin_dashboard=True)
    layout = LayoutHelper(logged_in=True, details=details)
    return render_template('mod_dashboard/uploaded-files.html', layout=layout.get_entries(), details=details)
github saurabhshri / ccextractor-web / mod_dashboard / controller.py View on Github external
output_file_extension=resp['output_file_extension'])

                    if rv['status'] == 'duplicate':
                        flash('Job with same conifguration already in the queue. Job #{job_number}'.format(job_number=rv['job_number']), 'warning')
                        log.warning('Duplicate job configuration for job number: {job_number} '.format(job_number=rv['job_number']))

                    elif rv['status'] == 'failed':
                        flash('Failed to add job! Reason : {reason}'.format(reason=rv['reason']), 'error')
                        log.error('Failed to add job! Reason : {reason}'.format(reason=rv['reason']))

                    else:
                        flash('Job added to queue. Job #{job_number}'.format(job_number=rv['job_number']), 'success')
                        log.debug('Job added to queue. Job #{job_number}'.format(job_number=rv['job_number']))
            else:
                details = DetailsForTemplate(g.user.id)
                layout = LayoutHelper(logged_in=True, details=details)
                return render_template('mod_dashboard/new_job.html',
                                       file=file,
                                       form=form,
                                       layout=layout.get_entries(),
                                       details=details)
        else:
            flash('Invalid new job request!', 'error')
    else:
        flash('Invalid new job request!', 'error')
    return redirect(url_for('mod_dashboard.dashboard'))
github saurabhshri / ccextractor-web / mod_dashboard / controller.py View on Github external
def user_list():
    details = DetailsForTemplate(g.user.id, admin_dashboard=True)
    layout = LayoutHelper(logged_in=True, details=details)
    return render_template('mod_dashboard/user-list.html', layout=layout.get_entries(), details=details)
github saurabhshri / ccextractor-web / run.py View on Github external
def internal_server_error_handler(e):
    """
    Handles the 500 error and displays a template.
    """
    if g.user is not None:
        details = DetailsForTemplate(g.user.id, admin_dashboard=False)
        layout = LayoutHelper(logged_in=True, details=details)
    else:
        layout = LayoutHelper(logged_in=False)
    return render_template('500.html', layout=layout.get_entries()), 500
github saurabhshri / ccextractor-web / mod_dashboard / controller.py View on Github external
def user_queue():
    details = DetailsForTemplate(g.user.id)
    layout = LayoutHelper(logged_in=True, details=details)
    return render_template('mod_dashboard/queue.html', layout=layout.get_entries(), details=details)
github saurabhshri / ccextractor-web / mod_dashboard / controller.py View on Github external
def admin_queue():
    details = DetailsForTemplate(g.user.id, admin_dashboard=True)
    layout = LayoutHelper(logged_in=True, details=details)
    return render_template('mod_dashboard/queue.html', layout=layout.get_entries(), details=details)