def formQuizStart(relation, fds, mvds): inputString = "<div class=\"well\">Du hast folgendes eingegeben:</div>" if DBnormalizer.longAttributeNamesUsed(): inputString = inputString = inputString + views.inputToString( relation, fds, mvds) inputString = inputString + "<div class=\"well\">Dass du gleich nicht so viel tippen musst, machen wir daraus mal das hier:</div>" DBnormalizer.resetDictionaries() inputString = inputString + views.inputToString(relation, fds, mvds) relationString = views.setOfAttributesToString(relation) fdsString = views.fdsToString(fds) + views.mvdsToString(mvds) html = """<form class="form" action="quiz.py" method="POST">""" html = html + "<p>Willkommen beim Quiz.</p>" html = html + """<input type="hidden" value=" """ + relationString + """" name="relation"></input> <input type="hidden" value=" """ + fdsString + """" name="fds"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value="1">Start</button> </div> </div> </form> """ return views.getJumbotron("Hallo.", html) + inputString
def formQuizStart(relation, fds, mvds): inputString ="<div class=\"well\">Du hast folgendes eingegeben:</div>" if DBnormalizer.longAttributeNamesUsed(): inputString = inputString = inputString + views.inputToString(relation, fds,mvds) inputString = inputString + "<div class=\"well\">Dass du gleich nicht so viel tippen musst, machen wir daraus mal das hier:</div>" DBnormalizer.resetDictionaries() inputString = inputString + views.inputToString(relation, fds,mvds) relationString = views.setOfAttributesToString(relation) fdsString = views.fdsToString(fds)+views.mvdsToString(mvds) html = """<form class="form" action="quiz.py" method="POST">""" html = html + "<p>Willkommen beim Quiz.</p>" html = html + """<input type="hidden" value=" """+relationString+"""" name="relation"></input> <input type="hidden" value=" """+fdsString+"""" name="fds"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value="1">Start</button> </div> </div> </form> """ return views.getJumbotron("Hallo.", html ) + inputString
try: relationString = str(form['relation'].value).replace(" ", "").replace( "\n", "").replace("\r", "") relation = set(relationString) | set(EMPTY_SET) fdsString = re.sub("(\r\n)*", "", str(form['fds'].value), 1) fds, mvds = DBnormalizer.parseInputFDsMVDs(fdsString) additionalFds = [] additionalMvds = [] step = str(form['step'].value).replace(" ", "").replace("\n", "").replace("\r", "") candidatekeys = DBnormalizer.getKeys(relation, fds) noRightSideAttributes = relation - DBnormalizer.getRightSideAttributes(fds) alert = "" info = "" inputpanel = views.inputToString(relation, fds, mvds, additionalFds, additionalMvds, "default") quizform = "" try: numberOfTries = int(form['numberOfTries'].value) numberOfSteps = int(form['numberOfSteps'].value) except KeyError: numberOfTries = 0 numberOfSteps = 0 numberOfTries = numberOfTries + 1 if (step == '1'): #candidate keys numberOfSteps = numberOfSteps + 1 quizform = quizForms.candidateKeys( numberOfTries, numberOfSteps, relationString, fdsString, candidatekeys, noRightSideAttributes) + htmlend()
try: relationString = str(form['relation'].value).replace(" ", "").replace("\n", "").replace("\r", "") relation = set(relationString)|set(EMPTY_SET) fdsString = re.sub("(\r\n)*", "", str(form['fds'].value), 1) fds,mvds = DBnormalizer.parseInputFDsMVDs(fdsString) additionalFds = [] step = str(form['step'].value).replace(" ", "").replace("\n", "").replace("\r", "") candidatekeys = DBnormalizer.getKeys(relation, fds) alert = "" info = "" inputpanel = views.inputToString(relation, fds, mvds, additionalFds, "default") quizform = "" try: numberOfTries = int(form['numberOfTries'].value) numberOfSteps = int(form['numberOfSteps'].value) except KeyError: numberOfTries = 0 numberOfSteps = 0 numberOfTries = numberOfTries + 1 if (step=='1'): #candidate keys numberOfSteps = numberOfSteps + 1 quizform = quizForms.candidateKeys(numberOfTries, numberOfSteps, relationString, fdsString) + htmlend() if (step=='2'): #validate candidate keys