html=1
elif html=='\n':
html=0
- if html == 1:
- script = "person.py?ID=" + str(row[1])
- name = row[0]
- return link_Template.substitute(script = script, text = name)
+
if row[0] == None:
return row[1]
else:
- return row[0] + "," +str(row[1])
+ if html==1:
+ script = "person.py?ID=" + str(row[1])
+ name = row[0]
+ return link_Template.substitute(script = script, text = name)
+ else:
+ return row[0] + "," +str(row[1])
def print_tagged_name(relationship,row,newLine):
if row[0]==None:
out = relationship + ": " + name_html(row,html)
return out + newLine
+def month_numbers(monthN):
+ if monthN == 0:
+ month ='unknown month'
+ elif monthN == 1:
+ month ='January'
+ elif monthN==2:
+ month ='February'
+ elif monthN==3:
+ month ='March'
+ elif monthN==4:
+ month ='April'
+ elif monthN==5:
+ month ='May'
+ elif monthN==6:
+ month ='June'
+ elif monthN==7:
+ month ='July'
+ elif monthN==8:
+ month ='August'
+ elif monthN==9:
+ month ='September'
+ elif monthN==10:
+ month ='October'
+ elif monthN==11:
+ month ='November'
+ elif monthN==12:
+ month ='December'
+ else:
+ month = 'Incorrectly entered month ' + str(monthN)
+ return month
def ordinal_numbers(number):
number = int(number)
return out
+def count_birth_month(newLine):
+ s = "SELECT bornMonth, count(*)"\
+ +" FROM people"\
+ +" GROUP BY bornMonth"\
+ +" ORDER BY bornMonth;"
+
+ t = "SELECT * FROM people WHERE bornMonth = ?;"
+
+ out = ''
+ for row in run_query(s,()):
+ month = month_numbers(row[0])
+ out = out + month + ': ' + str(row[1]) + newLine
+
+ if row[0]>12:
+ u = (row[0],)
+ out = out +print_query(t,u,newLine)
+
+ return out
+
+def count_death_month(newLine):
+ s = "SELECT diedMonth, count(*)"\
+ +" FROM people"\
+ +" GROUP BY diedMonth"\
+ +" ORDER BY diedMonth;"
+
+ t = "SELECT * FROM people WHERE diedMonth = ?;"
+
+ out = ''
+ for row in run_query(s,()):
+ month = month_numbers(row[0])
+ out = out + month + ': ' + str(row[1]) + newLine
+
+ if row[0]>12:
+ u = (row[0],)
+ out = out +print_query(t,u,newLine)
+
+ return out
+
+
def all_ancestors(personID,newLine):
#find parents
s = "SELECT people.Name,parents.parentID FROM"\
output = output + 'From: '+row[2] + newLine
output = output + 'To: '+row[4] + newLine
+ s = "SELECT people.Name,consort "\
+ +"FROM consorts LEFT JOIN people"\
+ +" ON people.ID = consorts.consort"\
+ +" WHERE consorts.ID = ?"
+ for row in run_query(s,t):
+ output = output + print_tagged_name('Consort',row,newLine)
+
output = output + newLine
#find parents
s = "SELECT people.Name,parents.parentID FROM"\