chiark / gitweb /
corrected link to source code
[familyTree.git] / cgiFiles / listAge.py
index b0b40914beaf26d1a0325b988834c5cdd558eee1..4ab29319cfc9360e1819eabac65f52933b8fdb78 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 import cgi
-import cgitb
+#import cgitb
 import sys
 import re
 sys.path.append('/home/naath/familyTreeProject/familyTree')
@@ -10,16 +10,25 @@ import everyPage
 
 [conn,form]=everyPage.top()
 
-result = 1
-if result == None:
-        everyPage.bad()
-else:   
+age = form.getvalue('age')
+if age == None:
         printMe = askQuestion.count_age_at_child('<br>')
         if len(printMe)<3:
                 printMe =  'sorry, no data <br>'
 
         everyPage.good(printMe)
 
+else:
+       result = re.match('[-]{0,1}[0-9]{1,4}$', str(age))
 
-everyPage.bottom(conn)
+       if result == None:
+               everyPage.bad()
+       else:
+               printMe  = askQuestion.people_had_child_at_age(age,'<br>')
+               if len(printMe)<10:
+                       printMe =  'sorry, no data <br>'
 
+                       everyPage.good(printMe)
+
+
+everyPage.bottom()