From 9f6e3416063cdcbb6195745be7b71dfe96c4a448 Mon Sep 17 00:00:00 2001 From: Anon Ray Date: Thu, 27 Jun 2013 21:41:37 +0530 Subject: [PATCH] Sweet store is now timestamp aware - adding timestamp validation and display in UI - removed the interface to add posts manually --- swtr.py | 12 ++++++++---- templates/layout.html | 2 ++ templates/show_entries.html | 18 +++--------------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/swtr.py b/swtr.py index 6c079ea..0549d00 100644 --- a/swtr.py +++ b/swtr.py @@ -37,11 +37,15 @@ app.jinja_env.filters['len'] = len def validateSweet(payload): for i in payload: - if len(i['who']) and len(i['what']) and len(i['where']) and len(i['how']): - pass - else: + try: + if len(i['who']) and len(i['what']) and len(i['where']) and\ + len(i['how']) and len(i['created']): + pass + else: + return False + except KeyError: return False - return True + return True @app.before_request def init_db(): diff --git a/templates/layout.html b/templates/layout.html index 4550a3f..c5d368e 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -11,9 +11,11 @@

SWeeT Store

+ Home | {% if not session.logged_in %} Log In {% else %} + Users | Add User | Log Out {% endif %} diff --git a/templates/show_entries.html b/templates/show_entries.html index 8824140..518260f 100644 --- a/templates/show_entries.html +++ b/templates/show_entries.html @@ -1,26 +1,14 @@ {% extends "layout.html" %} {% block body %} - {% if session.logged_in %} -
-
-
Who:
-
-
What:
-
-
Where:
-
-
How:
-
-
-
-
- {% endif %}
    {% if entries|len > 0 %} {% for entry in entries %}
  • @{{ entry.who }} #{{ entry.what }} /{{ entry.where }} {{ entry.how|safe }} + {% if entry.created|len > 0 %} + created: {{entry.created }} + {% endif %} -- 1.7.10.4