From cb0acf7ea60e102665a67a2ddd46af001c75f9ed Mon Sep 17 00:00:00 2001 From: Phyks Date: Tue, 23 Jul 2013 21:29:14 +0200 Subject: [PATCH] Flake8 errors corrected Corrected all errors given by Flake8 except line length --- TODO | 4 ---- pre-commit.py | 10 +++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index 49a8876..fd6cc7e 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,3 @@ What happen when a file is moved with git ? Flake8 the whole thing ! :) basepath ? tags / smileys / ... - -Known bugs: -========== -* Test RSS in Firefox (different view than traditionnal RSS view ?) diff --git a/pre-commit.py b/pre-commit.py index c636208..3a9f2f8 100755 --- a/pre-commit.py +++ b/pre-commit.py @@ -11,6 +11,7 @@ import subprocess from time import gmtime, strftime, mktime + def isset(variable): return variable in locals() or variable in globals() @@ -494,7 +495,7 @@ for i in years_list: except ValueError: continue - #Generate page per year + #Generate page per year page_year = header_gen.replace("@titre", params["BLOG_TITLE"]+" - "+i, 1) months_list = os.listdir("blog/"+i) @@ -508,7 +509,7 @@ for i in years_list: articles_list = list_directory("gen/"+i+"/"+j) articles_list.sort(key=lambda x: os.stat(x).st_mtime, reverse=True) - for article in articles_list: + for article in articles_list: try: with open(article, "r") as article_fh: article_content = article_fh.read() @@ -517,14 +518,13 @@ for i in years_list: except IOError: sys.exit("[ERROR] Error while generating years and months pages. Check your gen folder, you may need to regenerate some articles. The error was due to "+article+".") - page_month += footer_gen try: with open("blog/"+i+"/"+j+"/index.html", "w") as page_month_fh: page_month_fh.write(page_month) except IOError: - sys.exit("[ERROR] Unable to write index file for "+i+"/"+j+".") - + sys.exit("[ERROR] Unable to write index file for "+i+"/"+j+".") + page_year += footer_gen try: with open("blog/"+i+"/index.html", "w") as page_year_fh: