From: Oleg Broytman Date: Sat, 25 Feb 2006 16:47:08 +0000 (+0000) Subject: Fixed a bug: list all months in the year. X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=3e5349ebbd3c143b295455ec42116390605c3df5;p=phdru.name%2Fphdru.name.git Fixed a bug: list all months in the year. git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@7 7bb0bf08-9e0d-0410-b083-99cee3bf18b8 --- diff --git a/reindex_blog.py b/reindex_blog.py index 716605b..7612c02 100755 --- a/reindex_blog.py +++ b/reindex_blog.py @@ -210,15 +210,28 @@ def translate(tmpl): return tmpl +all_years = {} all_titles = [] for key in sorted(blog.keys()): + year, month, day = key + if year in all_years: + year_d = all_years[year] + else: + all_years[year] = year_d = {} + if month in year_d: + days_of_month = year_d[month] + else: + year_d[month] = days_of_month = [] + d = os.path.join(year, month, day) + days_of_month.append(d) title, tmpl, lead = blog[key] all_titles.append((key, translate(tmpl), title, lead)) all_titles = all_titles[-20:] + for year in sorted(years.keys()): year_titles = [] - months = years[year] + months = all_years[year] for month in sorted(months.keys()): month_titles = [] for day in sorted(months[month]):