From cb2022a2362b91c7298617f7ba0410e05a693e2d Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Thu, 9 Dec 2010 09:27:01 +0100 Subject: Using timestamp files for sorting entries --- blogthon.cgi | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/blogthon.cgi b/blogthon.cgi index 215c7fd..9d83df5 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -242,7 +242,15 @@ entries = [] entries_list = glob(entries_dir + '*.' + entries_suffix) for entry in entries_list: - timestamp = os.stat(entry) + title = entry.replace(entries_dir, '', 1) + title = title.replace('.' + entries_suffix, '') + + stampfile = os.path.join(entries_dir, title + '.stamp') + if os.path.exists(stampfile): + timestamp = os.stat(stampfile) + else: + timestamp = os.stat(entry) + timestamp = time.localtime(timestamp[8]) entry = timestamp, entry entries.append(entry) @@ -468,9 +476,17 @@ else: date = time.strftime("%c", entry[0]) date_to_compare = time.strftime("%m%Y", entry[0]) # Needed for permalinks entry = entry[1] - title = entry.replace('entries/', '', 1) + title = entry.replace(entries_dir, '', 1) title = title.replace('.' + entries_suffix, '') + stampfile = os.path.join(entries_dir, title + '.stamp') + if not os.path.exists(stampfile): + stamp = open(stampfile, 'w') + stamp.close() + else: + date = time.localtime(os.stat(stampfile)[8]) + date = time.strftime("%c", date) + if month_display == date_to_compare or not month_display: if post_display == title.replace(' ', '-') or not post_display: if allentries_display == "1" or entry_counter < entries_per_page: -- cgit v1.2.3