1 blog_filename = "blog_dict.pickle"
4 import cPickle as pickle
9 blog_file = open(blog_filename, "rb")
13 blog_dict = pickle.load(blog_file)
17 # blog_dict is a mapping
18 # (year, month, day) => [list of (file, title, lead, tags)]
21 for posts in blog_dict.itervalues():
22 for _file, _title, _lead, _tags in posts:
27 def _test_post(post, tree):
31 assert isinstance(tag, str)
34 elif op in ('AND', 'OR'):
35 value1 = _test_post(post, tree[1])
36 value2 = _test_post(post, tree[2])
38 return value1 and value2
40 return value1 or value2
42 return not _test_post(post, tree[1])
44 raise ValueError("Cannot get there")
48 for (year, month, day), posts in blog_dict.iteritems():
50 if _test_post(post, tree):
52 '/'.join((year, month, day, post[0].replace('.tmpl', '.html'))),