if html==1:
script = "person.py?ID=" + str(row[1])
name = row[0]
- return link_Template.substitute(script = script, text = name)
+ return link_Template.substitute(script = script\
+ , text = name)
else:
return row[0] + "," +str(row[1])
+def print_age_count(row,newLine):
+ if newLine == '<br>':
+ script = "age.py?age="+str(row[0])
+ link = link_Template.substitute(script = \
+ script, text = row[0])
+ return str(row[1]) + ' people had children at age '\
+ + link + newLine
+ else:
+ return print_row(row,newLine)
+
+
def print_tagged_name(relationship,row,newLine):
if row[0]==None:
out = relationship + " not yet entered: " + row[1]
out =out + terr_html(row[0],newLine) +newLine
return out
+
def list_people(newLine):
s = "SELECT name,id,bornyear"\
+" FROM people"\
+" WHERE p1.bornYear <> 0 and p2.bornYear<>0"\
+" GROUP BY age;"
- out = print_query(s,(),newLine)
+ out = ''
+ for row in run_query(s,()):
+ out = out + print_age_count(row,newLine)
+
return out
def people_had_child_at_age(age,newLine):
+" ON parents.ID = p1.ID"\
+" INNER JOIN people p2"\
+" ON parents.parentID = p2.ID"\
- +" WHERE age = ?"
+ +" WHERE age = ? AND p1.bornYear<>0 AND p2.bornYear<>0"
t = (int(age),)