~inspirated/arsenal/send-attachments-lpltk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python

import os, sys
from genshi.template import TemplateLoader

loader = TemplateLoader(
    os.path.join(os.path.dirname(__file__), 'templates'),
    auto_reload=True
)

tmpl = loader.load('toy.html')
stream = tmpl.generate(
    title='Hello world',
    style='index',
    content='Welcome!',
    links=[
        {'title':'Foobar1', 'username':'Joe', 'url':'http://cnn.com'},
        {'title':'Foobar2', 'username':'Joe', 'url':'http://cnn.com'},
        {'title':'Foobar3', 'username':'Joe', 'url':'http://cnn.com'},
        {'title':'Foobar4', 'username':'Bob', 'url':'http://cnn.com'},
        {'title':'Foobar5', 'username':'Joe', 'url':'http://cnn.com'},
        ]
    )

print stream.render('html', doctype='html')