From dc9e9a10af9dac7a05671627cfbea082c367d7e2 Mon Sep 17 00:00:00 2001 From: Phyks Date: Fri, 11 Jul 2014 13:35:30 +0200 Subject: [PATCH] Correct RFC822 for dates --- pre-commit.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pre-commit.py b/pre-commit.py index 78256cd..f2c2c3b 100755 --- a/pre-commit.py +++ b/pre-commit.py @@ -27,6 +27,7 @@ import subprocess import re import locale import markdown +from email import utils from hashlib import md5 from functools import cmp_to_key @@ -770,7 +771,7 @@ rss += ("\t" "\t\t"+params["COPYRIGHT"]+"\n" "\t\t"+params["WEBMASTER"]+"\n" "\t\t" + - strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())+"\n") + utils.formatdate(mktime(gmtime()))+"\n") # Generate header (except title) + index file + rss file @@ -805,10 +806,11 @@ for i, article in enumerate(["gen/"+x[4:-5]+".gen" for x in last_articles]): articles_header += "" articles_index += content - date_rss = strftime("%a, %d %b %Y %H:%M:%S +0000", - gmtime(mktime(datetime.datetime.strptime(date, - "%d%m%Y-%H%M") - .timetuple()))) + date_rss = utils.formatdate(mktime(gmtime(mktime(datetime. + datetime. + strptime(date, + "%d%m%Y-%H%M") + .timetuple())))) rss += ("\t\t\n" "\t\t\t"+remove_tags(title)+"\n"