def Delete(env, resp): # Get post content input = env['wsgi.input'] length = int(env.get('CONTENT_LENGTH', 0)) # If length is zero, post is empty - don't save it. if length > 0: postdata = input.read(length) fields = cgi.parse_qs(postdata) content = fields['playersToDelete'][0] # If the post is just whitespace, don't save it. content = content.strip() if content and content: # Save it in the database tournamentdb.deletePlayer(content) # 302 redirect back to the main page headers = [('Location', '/'), ('Content-type', 'text/plain')] resp('302 REDIRECT', headers) return ['Redirecting']
import tournamentdb # print "Hello %s, I want to say %t" %"You","goodbye" # - can't us t, the s refers to the data type of the substitution. #print "Hello %s, I want to say " % "You" # This line works #print "Hello %s, I want to say %s" % ("You", "goodbye") # print tournamentdb.getSwissPairings() tournamentdb.deletePlayer(68)