def main(): global name if request.method == 'GET': if name == "": titles = database.getStories() return render_template('Storynator.html', selected = False, titles = titles) else: title = database.getTitle(name) lines = database.getLines(name) titles = database.getStories() return render_template('Storynator.html', selected = True, title = title, titles = titles, lines = lines) else: button = request.form['button'] if button == 'go': name = request.form['story'] return redirect('/') elif button == 'create': title = request.form['title'] if title: database.newStory(title) return redirect('/') else: return redirect('/') elif button == 'addline': title = database.getTitle(name) line = request.form['line'] assert line != "" database.newLine(title,line) return redirect('/') elif button == 'main': name = "" return redirect('/')
def MGOTest(): database.newStory("The Road Not Taken") database.newLine("The Road Not Taken","Two roads diverged in a yellow wood,") database.newLine("The Road Not Taken","And sorry I could not travel both") database.newLine("The Road Not Taken","And be one traveler, long I stood") database.newLine("The Road Not Taken","And looked down one as far as I could") database.newLine("The Road Not Taken","To where it bent in the undergrowth;")