diff --git a/33-restful/tf-33.py b/33-restful/tf-33.py index cfff63e..7b5960a 100755 --- a/33-restful/tf-33.py +++ b/33-restful/tf-33.py @@ -2,7 +2,7 @@ import re, string, sys with open("../stop_words.txt") as f: - stops = set(f.read().split(",") + list(string.ascii_lowercase)) + stops = set(f.read().split(",")+list(string.ascii_lowercase)) # The "database" data = {} @@ -11,15 +11,15 @@ def error_state(): return "Something wrong", ["get", "default", None] # The "server"-side application handlers -def quit_handler(args): - sys.exit("Goodbye cruel world...") - def default_get_handler(args): rep = "What would you like to do?" rep += "\n1 - Quit" + "\n2 - Upload file" links = {"1" : ["post", "execution", None], "2" : ["get", "file_form", None]} return rep, links +def quit_handler(args): + sys.exit("Goodbye cruel world...") + def upload_get_handler(args): return "Name of file to upload?", ["post", "file"] @@ -37,13 +37,11 @@ def upload_post_handler(args): if args == None: return error_state() - filename = args[0] try: create_data(filename) except: return error_state() - return word_get_handler([filename, 0]) def word_get_handler(args):