From 302bdfbfd1a5d926b9ef0f946b6084a939555fa4 Mon Sep 17 00:00:00 2001 From: Howard Edson Date: Tue, 11 Feb 2014 20:20:34 -0800 Subject: [PATCH] permalink --- microblog.db | Bin 0 -> 3072 bytes microblog.py | 18 ++++++++++++++++-- templates/permalink.html | 10 ++++++++++ templates/show_entries.html | 6 +++--- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 microblog.db create mode 100644 templates/permalink.html diff --git a/microblog.db b/microblog.db new file mode 100644 index 0000000000000000000000000000000000000000..5b83236b6174f6b3b19b2636006ba34db462cf59 GIT binary patch literal 3072 zcmeHJ%}xR_5N@{{O)wrj5#=%o2OuDc8t)?EBnN-EcrpbCZ0vTS9TNA*8}UBgd<9>? z?z$Z0;u-CicBa#QoitxFO&{)tiV&u$O(ekuiy7za3V<;t%I;kO?rmI-bC<`zL9o-0 z#-V3L;)Dt9O+Zj!Clt7i_NwhRe}2CtZbTvDpc#A4#< zoq|bF') +def permalink(entry_id): + entry = get_one_entry(entry_id) + if entry: + return render_template('permalink.html', title=entry[0], text=entry[1]) + else: + abort(404) + if __name__ == '__main__': app.run(debug=True) diff --git a/templates/permalink.html b/templates/permalink.html new file mode 100644 index 0000000..e79b146 --- /dev/null +++ b/templates/permalink.html @@ -0,0 +1,10 @@ +{% extends "layout.html" %} +{% block body %} + {% if session.logged_in %} +

{{ title }}

+

{{ text }}

+ {% else %} +

You must be logged in to see a permalink (although I'm not sure why).

+ {% endif %} + Home +{% endblock %} diff --git a/templates/show_entries.html b/templates/show_entries.html index f44fd92..79b8388 100644 --- a/templates/show_entries.html +++ b/templates/show_entries.html @@ -8,7 +8,7 @@
- +
@@ -19,7 +19,7 @@

Posts

    {% for entry in entries %}
  • -

    {{ entry.title }}

    +

    {{ entry.title }}

    {{ entry.text|safe }}
    @@ -28,4 +28,4 @@

    {{ entry.title }}

  • No entries here so far
  • {% endfor %}
-{% endblock %} \ No newline at end of file +{% endblock %}