blob: 4285b943e94bbe2afebbf9e62f70ff52a42fe4a4 (
plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#writes out a pretty html table with categories side by side
version = 1.1
import time
import yaml
labs = []
for filename in ['techshop.yaml', 'emachineshop.yaml', 'fablab.yaml']:
f = open(filename)
labs += yaml.load(f)
#find the superset
categories = []
for lab in labs:
categories += lab['inventory'].keys()
categories = [i for i in set(categories)]
categories.sort()
print '<table>'
print '<thead valign="bottom">'
for lab in labs:
print '<td>'
print '<h2><a href="' + lab['link'] + '">'
print '<img src="' + lab['logo'] + '" alt="' + lab['name'] + '"></a></h2>'
print '</thead>'
print '<tbody valign="top">'
for category in categories:
print '<tr>'
for lab in labs:
inv = lab['inventory']
print '<td>'
print '<b>' + category + ': </b><br>'
if inv.__contains__(category) and inv[category]:
for item in inv[category]:
print ' ', item, '<br>'
print '</td>'
print '</tr>'
print '</tbody></table><br>'
print 'table generated by:'
print '<a href="http://fennetic.net/git/gitweb.cgi?p=skdb.git;a=tree;f=inventory/comparison">'
print 'skdb inventory comparison engine v', version, '</a><br>'
print 'on ', time.asctime(time.localtime(time.time())), time.time()
|