Beispiel #1
0
	def get(self):
		self.template_path = os.path.join(os.path.dirname(__file__), 'workout_create_or_edit.html')

		workout_key_string = self.request.get('edit')
		exercises = Exercise.all()
		self.template_vars['exercises'] = exercises
		#this is set if we are editing a workout
		if workout_key_string:
			try:
				workout = Workout.get(db.Key(workout_key_string))
			except db.BadKeyError:
				self.errors.append('The specified workout is invalid')
		 		self.dispatch()
				return
			
			#make sure they aren't trying to edit
			#someone elses workout
			if workout.user != self.user:
				raise "PossibleHackingException"
			
			workout_exercises = WorkoutExercise.gql('WHERE workout = :1', workout)
			self.template_vars['workout'] = workout
			self.template_vars['workout_exercises'] = workout_exercises
			
 		self.dispatch()
	def get(self):		
		exercises = Exercise.all()
		self.template_vars['exercises'] = exercises 
		self.template_path = os.path.join(os.path.dirname(__file__), 'exercises.html')
		self.dispatch()