예제 #1
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"))
예제 #2
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