def before_request(): g.teacher = False g.location, g.student = None, None if 'location' in session: g.location, g.student = session[ 'location' ], db.logged( session[ 'location' ] ) if not ( g.location and g.student ): del session[ 'location' ] g.location, g.student = None, None secret = None if 'secret' in session: secret = session[ 'secret' ] elif request.method == 'POST' and 'secret' in request.form: secret = request.form[ 'secret' ] if secret: g.teacher = secret == app.config[ 'SECRET_TEACHER' ]
def clear_questions(): if not 'location' in request.form: abort( 500 ) if not db.logged( request.form[ 'location' ] ): abort( 500 ) db.clear_questions( request.form[ 'location' ] ) return ''