#!/usr/cs/bin/python2.5 import cgi import headers def readFile (fname): records = [] f = open (fname, 'r') for line in f: # print "Reading: " + line entry = line.split(',') if not len(entry) == 4: print "Bad entry: " + str(entry) entry = map(lambda e: e.lstrip(' \t\n'), entry) entry = map(lambda e: e.rstrip(' \t\n'), entry) records.append(entry) return records def cmpPicno(a, b): if a == '' and b == '': return 0 if a == '': return 1 if b == '': return -1 return cmp(int(a), int(b)) def sortRecords(records, col): # columns: 0 =picture number, 1=last name, 2=first name, 3=institution if col == 0: records.sort (lambda a, b: cmpPicno(a[0], b[0])) elif col <= 3: records.sort (lambda a, b: cmp(a[col], b[col])) else: print "Error: bad sort index" def printTableKey(col): print '
| ' else: td = ' | ' # right align first entry for el in entry: print td + str(el) + " | " if oddrow: td = '' else: td = ' | ' print "" oddrow = not oddrow printTableKey(col) print " |
\n"
print '

\n"
form = cgi.FieldStorage()
if not form.has_key('col'):
colid = 1
else:
colid = int(form['col'].value)
print "
If you can help identify any of the untagged people in the picture, please send the picture number and name to David Shambroom (wds@intersystems.com) and David Evans (evans@cs.virginia.edu). """ headers.printFooter ()