Commit a67a3e48 authored by carignani's avatar carignani
Browse files

extracted template and added a bit of style

parent 93dc9d40
Loading
Loading
Loading
Loading

templates/home.html

0 → 100644
+51 −0
Original line number Diff line number Diff line
<!doctype html>

<html>

<head>
<title>tosca2doc</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

</head>
<body>

<div class="container-fluid">

{% with messages = get_flashed_messages() %}
  {% if messages %}
   <div class="alert alert-warning" role="alert">
    <ul class=flashes>
    {% for message in messages %}
      <li>{{ message }}</li>
    {% endfor %}
    </ul>
   </div>
  {% endif %}
{% endwith %}


<h1 style="text-align:center">TOSCA export</h1>
<div class="row">
	<div class="col-sm">
		<h2>tosca2doc</h2>
		<form action="/tosca2doc" method="post" enctype="multipart/form-data">
			Tosca YAML files:<br />
			<input type="file" name="file" multiple=""/><br />
			<input type="submit" value="Upload" />
		</form>
	</div>

	<div class="col-sm">
		<h2>doc2tosca</h2>
			<form action="/doc2tosca" method="post" enctype="multipart/form-data">
			Docx file:<br />
			<input type="file" name="file" /><br />
			<input type="submit" value="Upload" />
		</form>
	</div>
</div>

</div>
</body>

</html>
 No newline at end of file
+2 −15
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

import os

from flask import Flask, flash, request, redirect, url_for, send_file
from flask import Flask, flash, request, redirect, url_for, send_file, render_template
from werkzeug.utils import secure_filename
import docx

@@ -18,19 +18,6 @@ app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.secret_key = 'super secret key'
app.config['SESSION_TYPE'] = 'filesystem'

HOME='''
<!doctype html>
<title>tosca2doc</title>
<h1>tosca2doc & doc2tosca</h1>
<h2>tosca2doc</h2>
<form action="/tosca2doc" method="post" enctype="multipart/form-data">
Tosca YAML file:
<input type="file" name="file" multiple=""/>
<input type="submit" value="Upload" />
</form>
<h2>doc2tosca</h2>
'''

TOSCA_DEFS=['VNFD', 'NSD', 'PNFD']

def allowed_file(filename):
@@ -43,7 +30,7 @@ def allowed_file(filename):

@app.route("/")
def hello():
    return HOME 
    return render_template("./home.html") 

@app.route("/tosca2doc", methods=['POST'])
def mk_tosca2doc():