#!/Library/Frameworks/Python.framework/Versions/Current/bin/python # L-29 MCS 275 Fri 19 Mar 2010 : scripts_sort.py # Connects to the database server scripts_servdb.py # displays number of records and prompts for sort order. # upon submit calls the script_sortall.py. from socket import * hostname = 'localhost' # on same host number = 11267 # same port number buffer = 80 # size of the buffer def PrintHeader(title): """ writes title and header of page """ print """Content-type: text/html %s """ % title def PromptSortOrder(): """ Display a form to ask user for field to sort on and the order. """ print """

sort by type date name
order is ascending descending

""" def main(): """ Connects and prints data of server. """ PrintHeader('sorting all scripts') server_address = (hostname, number) client = socket(AF_INET, SOCK_STREAM) client.connect(server_address) data = client.recv(buffer) n = int(data) print "Number of scripts : %d" % n PromptSortOrder() client.close() main()