+ add error pages

This commit is contained in:
oleting
2021-01-14 16:18:01 +01:00
parent b045869591
commit f008d160d1
12 changed files with 78 additions and 12 deletions

8
run.py
View File

@@ -1,10 +1,10 @@
#!/usr/bin/env python
# from gui.gui import Gui
# import sys
from gui.gui import Gui
import sys
# do_debug = "--debug" in sys.argv
do_debug = "--debug" in sys.argv
# Gui(theme='DarkGrey11', debug_mode=do_debug)
Gui(theme='DarkGrey11', debug_mode=do_debug)

BIN
tmp/output.zip Normal file

Binary file not shown.

View File

@@ -7,7 +7,9 @@ def create_app(config_class=Config):
app.config.from_object(config_class)
from web_app.main.routes import main
from web_app.errors.handlers import errors
app.register_blueprint(main)
app.register_blueprint(errors)
return app

View File

View File

@@ -0,0 +1,23 @@
from flask import Blueprint, render_template
errors = Blueprint('errors', __name__)
@errors.app_errorhandler(404)
def error_404(error):
return render_template('errors/404.html'), 404
@errors.app_errorhandler(403)
def error_403(error):
return render_template('errors/403.html'), 403
@errors.app_errorhandler(500)
def error_500(error):
return render_template('errors/500.html'), 500
@errors.app_errorhandler(418)
def error_600(error):
return render_template('errors/418.html'), 418
@errors.app_errorhandler(512)
def error_600(error):
return render_template('errors/512.html'), 512

View File

@@ -46,15 +46,18 @@ def generator():
if form.validate_on_submit():
if form.java.data:
deleteFilesInFolder(os.path.join(os.path.abspath(os.path.join('Web', os.pardir)), f'../tmp/output/'))
input_path = javaDatei(form.java.data)
output_path = os.path.join(os.path.abspath(os.path.join('Web', os.pardir)), './tmp/input')
outputname = str(randint(0, 100) )
output_path_zip = os.path.join(os.path.abspath(os.path.join('Web', os.pardir)), f'./tmp/output/{outputname}')
remove_tags = None
comments = None
behaviour = OB.RANDOM_NAME
types = None
deleteFilesInFolder(str(os.path.join(os.path.abspath(os.path.join('Web', os.pardir)), './tmp/output/')))
NSD = NassiShneidermanDiagram(True)
output_directory = output_path + '/' + outputname
@@ -71,11 +74,10 @@ def generator():
NSD.load_from_file(input_path, custom_tags)
NSD.convert_to_image(output_directory, on_conflict=behaviour)
zip_path = os.path.join(os.path.abspath(os.path.join('Web', os.pardir)), f'../tmp/output/{outputname}')
shutil.make_archive(zip_path, 'zip', output_directory)
shutil.make_archive(output_path_zip, 'zip', output_directory)
deleteFilesInFolder(output_path)
return send_file(zip_path + '.zip', as_attachment=True)
return send_file(output_path_zip + '.zip', as_attachment=True)

View File

@@ -0,0 +1,7 @@
{% extends 'layout.html' %}
{% block content %}
<div class="content-section">
<h1>Fehler 403</h1>
<h5>Oops. Das dürfen Sie nicht!</h5>
</div>
{% endblock content %}

View File

@@ -0,0 +1,8 @@
{% extends 'layout.html' %}
{% block content %}
<div class="content-section">
<h1>Fehler 404</h1>
<h5>Oops. Diese Seite existiert nicht</h5>
<p>Hier gibt es nichts zusehen, suchen Sie an einem anderen Ort!</p>
</div>
{% endblock content %}

View File

@@ -0,0 +1,8 @@
{% extends 'layout.html' %}
{% block content %}
<div class="content-section">
<h1>Funktion nicht fertig.</h1>
<h5>Oops. Ole hat diese Funktion der Webseite noch nicht fertig gestellt.</h5>
<p>Versuch es in Zukunft nochmal oder frag Ole, wie lange er für diese Funktion noch brauch. Wenn du einen Verbesserungsvorschlag hast, melde dich bei Ole.</p>
</div>
{% endblock content %}

View File

@@ -0,0 +1,8 @@
{% extends 'layout.html' %}
{% block content %}
<div class="content-section">
<h1>Fehler 500</h1>
<h5>Oops. Ole oder Kons haben was falsch gemacht</h5>
<p>Versuch es in naher Zukunft nochmal.</p>
</div>
{% endblock content %}

View File

@@ -0,0 +1,8 @@
{% extends 'layout.html' %}
{% block content %}
<div class="content-section">
<h1>Die Seite wird gerade überarbeitet</h1>
<h5>Gedult!</h5>
<p>Hier gibt es nichts zusehen!</p>
</div>
{% endblock content %}

View File

@@ -27,7 +27,7 @@
</button>
<div class="collapse navbar-collapse" id="navbarToggle">
<div class="navbar-nav mr-auto">
<a class="nav-item nav-link" href="nassi.ole-siepmann.de">Home</a>
<a class="nav-item nav-link" href="http://nassi.ole-siepmann.de">Home</a>
<a class="nav-item nav-link" href="https://ole-siepmann.de/startseite/datenschutzerklaerung/">Datenschutz</a>
</div>
<!-- Navbar Right Side -->