diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2013-09-25 22:04:04 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2013-09-25 22:04:11 -0400 |
| commit | b3ad29f3c88842d5fa6745e03c609b63e47ef811 (patch) | |
| tree | ff7d3da2d4c75615e0e955e88587a094066bfb4d | |
| parent | 9ac5ba69009a5fea281f48cb12d625ffae380651 (diff) | |
| download | famille-flask-b3ad29f3c88842d5fa6745e03c609b63e47ef811.tar.gz | |
cosmetics
| -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): |
