diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2012-11-09 21:55:15 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2012-11-09 21:57:23 -0500 |
| commit | 1ae302ff76adcb188dad5383e73c5ade158ffd8a (patch) | |
| tree | e0b9c5f532c94efff272cfd3fafde81d494d0b91 /famille.py | |
| parent | 735bcbe949faea7818fc6f90fcdf47f485715b5a (diff) | |
| download | famille-flask-1ae302ff76adcb188dad5383e73c5ade158ffd8a.tar.gz | |
Stop insanity with timestamps
still need to check the function which imports the old database
Diffstat (limited to 'famille.py')
| -rw-r--r-- | famille.py | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -28,11 +28,10 @@ def shortify(string): return string @app.template_filter('format_date') -def format_date(datetime_string, format=u"%a %d %b %Y à %Hh%M".encode("utf8")): - if not datetime_string: +def format_date(date_object, format=u"%a %d %b %Y à %Hh%M".encode("utf8")): + if not date_object: return "" - return datetime.strptime(datetime_string[:-1], - "%Y-%m-%dT%H:%M:%S").strftime(format).decode("utf8") + return date_object.strftime(format).decode("utf8") @app.template_filter('pluralize') def pluralize(word, count, plural=None): @@ -190,8 +189,7 @@ def login(): session['user_name'] = user['user_name'] session['user_id'] = user['id'] g.db.execute("UPDATE users SET last_seen=? WHERE id=?", - (datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"), - session['user_id'])) + (datetime.utcnow(),session['user_id'])) g.db.commit() return redirect(url_for('list_news')) else: |
