def main(): # see if they have set up their reps profile information # todo: try and eliminate this bit of redundancy, we run this # query again every time a UserRequestHandler is instantiated try: RepsUser.all().filter("user ="******"(.*)", FirstLogin)], debug=True) wsgiref.handlers.CGIHandler().run(application) return application = webapp.WSGIApplication( [ ("/users/async/exercise_create-add_exercise_html", ExerciseCreate_AddExerciseHTML), ("/users/home", UserHome), ("/users/workout_create_or_edit", WorkoutCreateOrEdit), ("/users/workout_advanced_edit", WorkoutAdvancedEdit), ("/users/workout_log", WorkoutLog), ("/users/workout_print_log", WorkoutPrintLog), ("/users/my_workouts", MyWorkouts), ("/users/workout_log_view", WorkoutLogView), ("/users/workout_view", WorkoutView), ], debug=True, ) wsgiref.handlers.CGIHandler().run(application)
def post(self, garbage): reps_user = None; nickname = self.request.get('nickname') redirect_url = self.request.get('redirect_url') #if self.reps_user is not None, then the super class found a reps_user #in which case they should not be creating another if self.reps_user or re.match('^[a-zA-Z0-9_]{4,28}$',nickname) is None: raise "FirstLoginException" #check to see that the user name isn't already taken try: reps_user = RepsUser.all().filter('nickname =', nickname).fetch(1)[0] except IndexError: pass #we want this if reps_user: self.errors.append('This nickname is not available. Please choose another.') self.get(redirect_url) return RepsUser(user=self.user,nickname=nickname).put() self.redirect(redirect_url)
def __init__(self): webapp.RequestHandler.__init__(self) self.template_path = "" self.template_vars = {} self.user = None self.reps_user = None self.errors = [] self.messages = [] ##################################### self.user = users.get_current_user() self.template_vars["errors"] = self.errors self.template_vars["messages"] = self.messages if self.user: try: self.reps_user = RepsUser.all().filter("user ="******"reps_user"] = self.reps_user except IndexError: pass # the user hasn't created a profile self.template_vars["logout_url"] = users.create_logout_url("//") else: self.template_vars["login_url"] = users.create_login_url("/users/home")