Using timestamp files for sorting entries
This commit is contained in:
parent
0f4bdcfc21
commit
cb2022a236
20
blogthon.cgi
20
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:
|
||||
|
Loading…
Reference in New Issue
Block a user