]> git.phdru.name Git - phdru.name/phdru.name.git/commitdiff
Fixed a bug: list all months in the year.
authorOleg Broytman <phd@phdru.name>
Sat, 25 Feb 2006 16:47:08 +0000 (16:47 +0000)
committerOleg Broytman <phd@phdru.name>
Sat, 25 Feb 2006 16:47:08 +0000 (16:47 +0000)
git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@7 7bb0bf08-9e0d-0410-b083-99cee3bf18b8

reindex_blog.py

index 716605bf2a7a529e55ab5a35050ffbfb038595fc..7612c024a9c4686452ae399a342ae58e69ab889b 100755 (executable)
@@ -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]):