Esempio n. 1
0
def sengen():
    if request.method == "GET":
        return render_template('sengen.html',
                               title='Sentence Generator',
                               Sentences='')
    elif request.method == "POST":
        sentences = request.form
        if int(sentences['numsen']) > 0:
            return render_template('sengen.html',
                                   title='Sentence Generator',
                                   Sentences=story.senGen(
                                       int(sentences['numsen'])))
        else:
            return render_template('sengen.html',
                                   title='Sentence Generator',
                                   Sentences='Invalid number of sentences')

    else:
        return 'yo'
Esempio n. 2
0
def sengen():
    return render_template('sengen.html',
                           title='Sentence Generator',
                           Sentences=story.senGen(5))
Esempio n. 3
0
def sengen():
    if request.method=="GET":
        return render_template('sengen.html', title='Sentence Generator', Sentences='')
    elif request.method=="POST":
        sentences=request.form
        if numCheck(sentences['numsen']):
            if int(float(sentences['numsen']))>50:
                return render_template('sengen.html', title='Sentence Generator', Sentences=story.senGen(50), error="Input too high. Generating 50 sentences")
            elif int(float(sentences['numsen']))<=0:
                return render_template('sengen.html', title='Sentence Generator', error='Invalid number of sentences')
            else:
                return render_template('sengen.html', title='Sentence Generator', Sentences=story.senGen(int(float(sentences['numsen']))))
        else:
            return render_template('sengen.html', title='Sentence Generator', error='Invalid number of sentences')
        
    else:
        return 'yo'
Esempio n. 4
0
def sengen():
    return render_template("sengen.html", title="Sentence Generator", Sentences=story.senGen(5))