File: printhtml.py

package info (click to toggle)
gaby 2.0.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,148 kB
  • ctags: 3,101
  • sloc: ansic: 48,660; sh: 8,710; python: 1,161; makefile: 951; perl: 265; sed: 93; xml: 89; sql: 25
file content (28 lines) | stat: -rwxr-xr-x 522 bytes parent folder | download | duplicates (4)
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
#! /usr/bin/env python

import sys
import gaby

gaby.load_database('gaby')
st = gaby.get_subtable_by_name('Address Book')

records = []
for id in st.fast_records_list():
	records.append( st.get_record_no(id) )

def cmpfunc(x, y):
	if len(y[1]) == 0: return 0
	if len(x[1]) == 0: return 1
	return cmp(x[1], y[1])

records.sort( lambda x,y: cmpfunc(x, y) )

print '<html><head><title>Address Book</title></head>\n<body><table>'

for r in records:
	print '<tr><td>', r[0], '<td>', r[1]

print '</table></html>'

sys.exit(0)