Formatting to fit 2 pages
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
import re, string, sys
|
import re, string, sys
|
||||||
|
|
||||||
with open("../stop_words.txt") as f:
|
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"
|
# The "database"
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
@@ -11,15 +11,15 @@ def error_state():
|
|||||||
return "Something wrong", ["get", "default", None]
|
return "Something wrong", ["get", "default", None]
|
||||||
|
|
||||||
# The "server"-side application handlers
|
# The "server"-side application handlers
|
||||||
def quit_handler(args):
|
|
||||||
sys.exit("Goodbye cruel world...")
|
|
||||||
|
|
||||||
def default_get_handler(args):
|
def default_get_handler(args):
|
||||||
rep = "What would you like to do?"
|
rep = "What would you like to do?"
|
||||||
rep += "\n1 - Quit" + "\n2 - Upload file"
|
rep += "\n1 - Quit" + "\n2 - Upload file"
|
||||||
links = {"1" : ["post", "execution", None], "2" : ["get", "file_form", None]}
|
links = {"1" : ["post", "execution", None], "2" : ["get", "file_form", None]}
|
||||||
return rep, links
|
return rep, links
|
||||||
|
|
||||||
|
def quit_handler(args):
|
||||||
|
sys.exit("Goodbye cruel world...")
|
||||||
|
|
||||||
def upload_get_handler(args):
|
def upload_get_handler(args):
|
||||||
return "Name of file to upload?", ["post", "file"]
|
return "Name of file to upload?", ["post", "file"]
|
||||||
|
|
||||||
@@ -37,13 +37,11 @@ def upload_post_handler(args):
|
|||||||
|
|
||||||
if args == None:
|
if args == None:
|
||||||
return error_state()
|
return error_state()
|
||||||
|
|
||||||
filename = args[0]
|
filename = args[0]
|
||||||
try:
|
try:
|
||||||
create_data(filename)
|
create_data(filename)
|
||||||
except:
|
except:
|
||||||
return error_state()
|
return error_state()
|
||||||
|
|
||||||
return word_get_handler([filename, 0])
|
return word_get_handler([filename, 0])
|
||||||
|
|
||||||
def word_get_handler(args):
|
def word_get_handler(args):
|
||||||
|
|||||||
Reference in New Issue
Block a user