5 sys.path.append('/home/naath/familyTreeProject/cgiFiles')
6 import askQuestion as aQ
7 import graphQuestions as gQ
8 import printUtils as pU
9 import englishUtils as eU
13 [conn,form]=everyPage.top()
18 s = "select * from marriages ORDER BY ida;"
20 nPeople = aQ.number_people()
28 #printMe=pU.table_header(['person 1','ID1','person 2','ID2','relationship','year of marriage'],'<br>')
29 printMe=pU.table_header(['person 1','person 2','relationship','year of marriage'],'<br>')
31 cuz = re.compile('(<a.*?</a>) and (<a.*?</a>) are (.*)')
32 parent = re.compile('(<a.*?</a>) is (<a.*?</a>)\'s (.*)')
33 for row in aQ.run_query(s,()):
34 if not eU.is_number(row[1]):
39 if ID2>nPeople or ID1>nPeople or ID2==0:
42 relationship = row[-1]
45 relationship = aQ.find_relationship(ID1,ID2,0)
47 if relationship[-15:]!='are not related':
49 marriedYear = pU.print_year(row[4])
52 splitR = cuz.search(relationship)
54 splitR = parent.search(relationship)
55 #need to get ID numbers out of the URL because they are sometimes reversed
56 #should be a simple regex
57 # cols = [splitR.group(1),ID1,splitR.group(2),\
58 # ID2,splitR.group(3),marriedYear]
59 cols = [splitR.group(1),splitR.group(2),\
60 splitR.group(3),marriedYear]
62 printMe+=pU.table_row(cols,'<br>')
65 printMe+=pU.table_foot('<br>')
70 everyPage.good(printMe)
71 file = '/home/naath/public-html/spouses-related.html'
72 everyPage.to_file(file)