diff --git a/flaskr/blog.py b/flaskr/blog.py index 8082d2f..6bf9b55 100644 --- a/flaskr/blog.py +++ b/flaskr/blog.py @@ -86,10 +86,9 @@ def get_post(id, check_author=True): return post -@bp.route('//') +@bp.route('/') def individual_post(id): - post = dict(get_post(id, False)) - post['body'] = markdown.markdown(post['body']) + post = get_post(id, False) return render_template('blog/post.html', post=post) @bp.route('//update', methods=('GET', 'POST')) diff --git a/flaskr/templates/blog/index.html b/flaskr/templates/blog/index.html index f50de7f..7f1e4e8 100644 --- a/flaskr/templates/blog/index.html +++ b/flaskr/templates/blog/index.html @@ -12,7 +12,7 @@
-

{{ post['title'] }}

+

{{ post['title'] }}

by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}
{% if g.user['id'] == post['author_id'] %} diff --git a/tests/test_blog.py b/tests/test_blog.py index 548363a..175e5b5 100644 --- a/tests/test_blog.py +++ b/tests/test_blog.py @@ -13,7 +13,6 @@ def test_index(client, auth): assert b'by test on 2018-01-01' in response.data assert b'test\nbody' not in response.data assert b'href="/1/update"' in response.data - assert b'href="/1/"' in response.data def test_firehose(client, auth): response = client.get('/') @@ -21,7 +20,7 @@ def test_firehose(client, auth): assert b"Register" not in response.data auth.login() - response = client.get('/firehose') + response = client.get('/') assert b'Log Out' in response.data assert b'test title' in response.data assert b'by test on 2018-01-01' in response.data @@ -29,7 +28,7 @@ def test_firehose(client, auth): assert b'href="/1/update"' in response.data def test_individual_page(client, auth): - response = client.get('/1/') + response = client.get('/1') assert b'test title' in response.data assert b'by test on 2018-01-01' in response.data assert b'test\nbody' in response.data