Exemple #1
0
    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}
Exemple #2
0
    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}
Exemple #3
0
 def get(self):
     """
     render the link page
     """
     return render_template(
         'link.html', 
         google_users_api = users, 
         active_user = get_active_user(),
         )
Exemple #4
0
 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)
Exemple #5
0
 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
         )
Exemple #6
0
 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,
             )
Exemple #8
0
 def get(self):
     return render_template(
         'front.html',
         active_user=get_active_user(),
         google_users_api=users,
     )
Exemple #9
0
 def get(self):
     return render_template(
         'front.html', 
         active_user = get_active_user(),
         google_users_api = users,
         )