aboutsummaryrefslogtreecommitdiffstats
path: root/blogthon.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'blogthon.cgi')
-rwxr-xr-xblogthon.cgi21
1 files changed, 18 insertions, 3 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index 79f7ca2..9f4877b 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -18,6 +18,7 @@ import sys
import time
import locale
import re
+import marshal
from cgi import FieldStorage
from smtplib import SMTP
from hashlib import md5
@@ -207,7 +208,6 @@ if vars(options).values().count(True) > 1:
if options.info:
num_entries = len(glob(os.path.join(entries_dir, "*." + entries_suffix)))
num_comments = 0
-
comments = glob(os.path.join(entries_dir, "*.comments"))
for file in comments:
content = open(file, "r")
@@ -215,13 +215,28 @@ if options.info:
if line.startswith("-"):
num_comments += 1
content.close()
-
print("Number of entries: %s" % num_entries)
print("Number of comments: %s" % num_comments)
sys.exit(0)
if options.tags:
- print("Tags are coming soon...")
+ try:
+ tagindex = []
+ entries = glob(os.path.join(entries_dir, "*." + entries_suffix))
+ for entry in entries:
+ content = open(entry, "r")
+ tagline = content.readline().strip()
+ if re.match(line_start_plus, tagline):
+ taglist = tagline.split("+")[1:]
+ for tag in taglist:
+ tagindex.append([tag.strip(), entry])
+ content.close()
+ tagfile = open(os.path.join(entries_dir, "tags"), "w")
+ marshal.dump(tagindex, tagfile)
+ tagfile.close()
+ print("Index created!")
+ except:
+ print("Error creating index!")
sys.exit(0)
# Read POST variables