Skip to content

Commit 9f4dd57

Browse files
committed
Tweaks from Adrian's review
1 parent afbe8c2 commit 9f4dd57

File tree

12 files changed

+16
-32
lines changed

12 files changed

+16
-32
lines changed

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"request": "launch",
6565
"module": "flask",
6666
"env": {
67-
"FLASK_APP": "HelloFlask/app.py"
67+
"FLASK_APP": "hello_flask/app.py"
6868
},
6969
"args": [
7070
"run",
@@ -122,4 +122,4 @@
122122
]
123123
}
124124
]
125-
}
125+
}

HelloFlask/app.py

Lines changed: 0 additions & 5 deletions
This file was deleted.
File renamed without changes.

hello_flask/app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from hello_flask import app
2+
from hello_flask import views
3+
4+
# Time-saver: output a URL to the VS Code terminal so you can easily Ctrl+click to open a browser
5+
# print('http://127.0.0.1:5000/hello/VSCode')
File renamed without changes.
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% extends "layout.html" %}
22
{% block content %}
33
<p>About page for the Flask tutorial.p>
4-
{% endblock %}
4+
{% endblock %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% extends "layout.html" %}
22
{% block content %}
33
<p>Contact page for the Flask tutorial.p>
4-
{% endblock %}
4+
{% endblock %}

HelloFlask/templates/hello_there.html renamed to hello_flask/templates/hello_there.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
<body>
99
<span class="message">Hello there, {{ name }}!span> It's {{ date.strftime("%A, %d %B, %Y at %X") }}.
1010
body>
11-
html>
11+
html>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% extends "layout.html" %}
22
{% block content %}
33
<p>Home page for the Flask tutorial.p>
4-
{% endblock %}
4+
{% endblock %}

HelloFlask/templates/layout.html renamed to hello_flask/templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
footer>
2323
div>
2424
body>
25-
html>
25+
html>
Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
from datetime import datetime
2-
from re import match
3-
42
from flask import Flask, render_template
5-
6-
from HelloFlask import app
7-
3+
from hello_flask import app
84

95
@app.route('/')
106
def home():
@@ -22,23 +18,11 @@ def contact():
2218
def hello_there(name):
2319
return render_template(
2420
"hello_there.html",
25-
title ='Hello, Flask',
26-
name = clean_name(name),
27-
date = datetime.now()
21+
title='Hello, Flask',
22+
name=name,
23+
date=datetime.now()
2824
)
2925

3026
@app.route('/api/data')
3127
def get_data():
3228
return app.send_static_file('data.json')
33-
34-
def clean_name(name):
35-
# Filter the name argument to letters only using regular expressions. URL arguments
36-
# can contain arbitrary text, so we restrict to safe characters only.
37-
match_object = match("[a-zA-Z]+", name)
38-
39-
if match_object:
40-
clean_name = match_object.group(0)
41-
else:
42-
clean_name = "Friend"
43-
44-
return clean_name

0 commit comments

Comments
 (0)