Example #1
0
def home():
	global storyname
	storyname = ""
	if request.method == "GET":
		return render_template("home.html", stories = mongo.get_stories())
	else:
		button = request.form["button"]
		if button == "Go":
			storyname = str(request.form["storyselection"])
			return redirect(url_for("story"))
		if button == "Add":
			mongo.addstory(str(request.form["storyname"]))
			return render_template("home.html", stories = mongo.get_stories())
Example #2
0
def story():
	if storyname == "":
		global storyname
		storyname = "Once upon a time"
	if request.method == "GET":
		return render_template("story.html", story = storyname, lines = (mongo.get_story(storyname))[1:])
	else:
		button = request.form["button"]
		if button == "Submit":
			if storyname not in mongo.get_stories():
				mongo.addstory(storyname)
			mongo.addline(storyname, str(request.form["line"]))
			return render_template("story.html", story = storyname, lines = (mongo.get_story(storyname))[1:])
		if button == "Cancel":
			global storyname
			storyname = ""
			return redirect(url_for("home"))
Example #3
0
#!usr/bin/python
import mongo

if __name__ == "__main__":
	mongo.startup()
	mongo.addstory("tale of something")
	mongo.addline("tale of something", "some stuff happened somewhere")
	mongo.addline("tale of something", "at sometime")
	for story in mongo.get_stories():
		print story
	print "\n\n\n"
	for line in  mongo.get_story("tale of something"):
		print line