def post(self): """ attempt to redeem a coupon code; if none exists, return an error """ parser = reqparse.RequestParser() parser.add_argument('sponsor_code', type=str) args = parser.parse_args() sponsor_code = args['sponsor_code'] success = False if verify_code(sponsor_code): teacher = get_active_user() if teacher: try: redeem_code( teacher = teacher, coupon_code = sponsor_code ) except Exception as e: logging.info(e) else: success = True if success: return {'success' : True} else: return {'success' : False}
def post(self): """ attempt to redeem a coupon code; if none exists, return an error """ parser = reqparse.RequestParser() parser.add_argument('sponsor_code', type=str) args = parser.parse_args() sponsor_code = args['sponsor_code'] success = False if verify_code(sponsor_code): teacher = get_active_user() if teacher: try: redeem_code(teacher=teacher, coupon_code=sponsor_code) except Exception as e: logging.info(e) else: success = True if success: return {'success': True} else: return {'success': False}
def get(self): """ render the link page """ return render_template( 'link.html', google_users_api = users, active_user = get_active_user(), )
def get(self, username): """ get request displays the teacher's profile page """ teacher = get_user_by_username(username) return render_template('profile.html', teacher=teacher, active_user=get_active_user(), google_users_api=users, mathjax=True)
def get(self, username): """ get request displays the teacher's profile page """ teacher = get_user_by_username(username) return render_template( 'profile.html', teacher = teacher, active_user = get_active_user(), google_users_api = users, mathjax = True )
def get(self): """ handle the get request for the edit content page """ if not users.get_current_user(): abort(401) else: return render_template( 'edit.html', active_user=get_active_user(), google_users_api=users, stripe_publish_key=pub_key, mathjax=True, )
def get(self): """ handle the get request for the edit content page """ if not users.get_current_user(): abort(401) else: return render_template( 'edit.html', active_user = get_active_user(), google_users_api = users, stripe_publish_key = pub_key, mathjax = True, )
def get(self): return render_template( 'front.html', active_user=get_active_user(), google_users_api=users, )
def get(self): return render_template( 'front.html', active_user = get_active_user(), google_users_api = users, )