--- /dev/null
+blog_filename = "blog_dict.pickle"
+
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
+try:
+ blog_file = open(blog_filename, "rb")
+except IOError:
+ blog_dict = {}
+else:
+ blog_dict = pickle.load(blog_file)
+ blog_file.close()
+
+
+# blog_dict is a mapping
+# (year, month, day) => [list of (file, title, lead, tags)]
+
+def tag_exists(tag):
+ for posts in blog_dict.itervalues():
+ for _file, _title, _lead, tags in posts:
+ if tag in tags:
+ return True
+ return False