aboutsummaryrefslogtreecommitdiffstats
path: root/blogthon.cgi
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2010-12-09 09:27:01 +0100
committerStefan Ritter <xeno@thehappy.de>2010-12-09 09:27:01 +0100
commitcb2022a2362b91c7298617f7ba0410e05a693e2d (patch)
tree613bf70c752e0fb6af16e9506c964f5375976a9f /blogthon.cgi
parent0f4bdcfc21297075ccc188cd49ecac7431e69180 (diff)
Using timestamp files for sorting entries
Diffstat (limited to '')
-rwxr-xr-xblogthon.cgi20
1 files 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: