renamed gas.py gasweb.py

parent af81d5b0
import os
import re
import gradaudit.gradaudit as gradaudit
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def input_form():
return render_template('GASGUI.html')
@app.route('/submit', methods=['POST'])
def submit():
name = request.form['name']
degree = request.form['degreeType']
major = request.form['MajorList']
year = request.form['YearList']
spec = request.form['SpecializationOfDegree'].lower()
classes = request.form['classesTaken'].replace(' ','')
transcript = '{0}\n'\
'{1},{2},{3},{4}\n'\
'{5}\n'.format(name,
degree, major, year, spec,
classes)
student_data = gradaudit.parse_transcript(transcript)
main_contents = gradaudit.gen_main(*student_data)
with open('main.lp','w') as main_file:
main_file.write(main_contents)
response = os.popen('sasp main.lp').read()
can_grad = 'ableToGraduate({0})'.format(name) in response
reqClasses = re.findall('[a-zA-z]+[1-4][0-9][0-9V][0-9]',response)
return render_template('GASTemplate.html',
ableToGraduate=can_grad,
studentName=name,
requiredClasses=reqClasses,
degree=major)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment