def init(cfgFile): with open(cfgFile, "r") as fp: config = yaml.safe_load(fp) assignment_id = config["assignments"][ 0] # In the future, there might be a select box displayed students = load_students(assignment_id, config["dates"]) return (students, config["dates"])
def validate(): for student in students.load_students(): missing = [key for key in required_keys if key not in student.keys()] if missing: print() print("** ERR ", end=' ') pprint(student) print("** is missing the following keys ", end=' ') pprint(missing) continue if not type(student['forges']) is list: print("** ERR: forges for", student['name'], "is not a list.") continue print("Entry %s (%s) looks okay!" % (student['name'], student['irc']))
def validate(): for student in students.load_students(): missing = [key for key in required_keys if key not in student.keys()] if missing: print print "** ERR ", pprint(student) print "** is missing the following keys ", pprint(missing) continue if not type(student['forges']) is list: print "** ERR: forges for", student['name'], "is not a list." continue print "Entry %s (%s) looks okay!" % (student['name'], student['irc'])
from students import students, load_students from tests import tests, load_tests from admin import admin app = Flask(__name__) app.register_blueprint(tests) app.register_blueprint(students) app.register_blueprint(admin) app.config.from_pyfile('defaults/defaults.conf') app.config.from_pyfile('tester.conf') load_tests() load_students() @app.route('/') def index(): return render_template('index.html') @app.route('/about/') def about(): return render_template('about.html') @app.before_request def before_request(): g.db = MongoClient( app.config['DB_HOST'], app.config['DB_PORT'] ).tester