Exemplo n.º 1
0
def view(id):
    t = Template(file='templates/view.html')
    data = db[id]
    t.name = data['name']
    t.item_list = data['items']
    t.since = data['since']
    t.place = data['place']

    return str(t)
Exemplo n.º 2
0
def edit(id):
    t = Template(file='templates/edit.html')
    data = db[id]
    t.identifier = id
    t.name = data['name']
    t.content = "\n".join(x for x in data['items'])
    t.since = data['since']
    t.place = data['place']

    return str(t)
Exemplo n.º 3
0
def printer(id):
    t = Template(file='templates/print.html')
    data = db[id]
    t.id = id
    t.name = data['name']
    items = data['items']
    items += ['']
    n = int(math.floor(len(items) / 2.0))
    item_pairs = [(k, items[n + m]) for m, k in enumerate(items[:n])]

    t.item_list = item_pairs
    t.since = data['since']

    return str(t)