Exemple #1
0
def index():
    user = UserSession()

    if request.method == "POST":
        form = request.form
        country = form.get("country_select", "CA")
        source = form.get("source", "")

        user.template.country = country
        user.template.source = source

        job = Job(False, input_type="qt")

        obj = job.process_email(user.template.html,
                                source_code=source,
                                country=country)
        user.template.html = obj.get_content()
        user.template.result_images = str(obj.get_images())
        user.template.result_links = str(obj.get_links())
        user.template.result_source = str(obj.get_source_codes())
        user.template.result_notes = str(obj.notifications)
        db.session.add(user.template)
        db.session.commit()

        return render_template("index.html",
                               result=True,
                               country=user.template.country)

    return render_template("index.html", country=user.template.country)