diff options
| -rw-r--r-- | famille.py | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import sqlite3 #all the imports from flask import Flask, request, session, g, redirect, url_for, render_template from functools import wraps @@ -40,23 +39,23 @@ def shortify(string): return string @app.template_filter('format_date') -def format_date(date_object, format=u"%a %d %b %Y à %Hh%M"): +def format_date(date_object, formatstr=u"%a %d %b %Y à %Hh%M"): if not date_object: return "" - format = format.encode("utf8") - return date_object.replace(tzinfo=timezone('utc')). \ - astimezone(timezone(session['timezone'])).strftime(format).decode("utf8") + formatstr = formatstr.encode("utf8") + return date_object.replace(tzinfo=timezone('utc')).\ + astimezone(timezone(session['timezone'])).strftime(formatstr).decode("utf8") @app.template_filter('format_ago') -def format_ago(date_object, format): +def format_ago(date_object, formatstr): if not date_object: return "" - format = format.encode("utf8") - readable = date_object.replace(tzinfo=timezone('utc')). \ - astimezone(timezone(session['timezone'])).strftime(format) + formatstr = formatstr.encode("utf8") + readable = date_object.replace(tzinfo=timezone('utc')).\ + astimezone(timezone(session['timezone'])).strftime(formatstr) iso_format = date_object.strftime('%Y-%m-%dT%H:%M:%SZ') - return '<span class=timeago title="{0}">{1}</span>'. \ - format(iso_format, readable).decode("utf8") + return '<span class=timeago title="{0}">{1}</span>'.\ + format(iso_format, readable).decode("utf8") @app.template_filter('format_rfc2822') def format_rfc2822(date_object): |
