コード例 #1
0
	def delete(self):
		'''
		This is a very simple delete function that uses notificationId to select the notification and then delete it.
		Although, you need to do .key.delete() in order to delete it. There is no delete function for entities. In fact
		there is no put function either, the constructor above returns a key. So you actually need to call .key.put()
		'''
		statusCode = 201
		notificationId = self.request.get('notificationId')
		logging.info(self.request.get('notificationId'))
		notification = Notification.get_by_id(int(notificationId))
		if notification:
			statusCode = 200
			notification.key.delete()
		logging.info(statusCode)
		self.response.write(json.dumps({'statusCode': statusCode}))
コード例 #2
0
	def getDetail(self, notificationId):
		#statusCodes:
		#200 ok
		#201 other error
		statusCode = 202
		notifications = []
		#USE workout.query to return all workouts and select the one that has the right id
		# also use debug.log to return inportant information 
		for notification in Notification.query():
			logging.debug(notification.JSONOutputDetail())
		logging.debug(notificationId)
		notification = Notification.get_by_id(int(notificationId))
		if notification:
			statusCode = 200
			notifications.append(notification.JSONOutputDetail())
		self.response.write(json.dumps({'statusCode': statusCode, 'notifications': notifications}))