|
|
@ -50,9 +50,22 @@ def chunk(iterable, chunksize, fillvalue=None):
|
|
|
|
def render_index(email_list, title, identifier):
|
|
|
|
def render_index(email_list, title, identifier):
|
|
|
|
email_list = chunk(email_list, 4)
|
|
|
|
email_list = chunk(email_list, 4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
current_page = 0
|
|
|
|
|
|
|
|
|
|
|
|
for list_chunk in email_list:
|
|
|
|
for list_chunk in email_list:
|
|
|
|
for message in list_chunk:
|
|
|
|
variables = {
|
|
|
|
print message[0]
|
|
|
|
'page': title,
|
|
|
|
|
|
|
|
'pagenum': "Page %d of %d" % (current_page + 1, len(email_list)),
|
|
|
|
|
|
|
|
'title': options['title'],
|
|
|
|
|
|
|
|
'index': "../index.html",
|
|
|
|
|
|
|
|
'items': "".join('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>' % (message[0], message[3], message[4], message[5], message[6], message[7]) for message in list_chunk)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print template_index % variables
|
|
|
|
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
current_page += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if os.path.isfile(options['database']) == False:
|
|
|
|
if os.path.isfile(options['database']) == False:
|
|
|
|
print "Database file not found. Use the -d switch to specify a custom database path."
|
|
|
|
print "Database file not found. Use the -d switch to specify a custom database path."
|
|
|
|