Beispiel #1
0
	def get(self,id):
		self.response.headers['Content-Type'] = 'application/json; charset=utf-8'
		#output to the browser
		obj = datahandler.getData(id)
		if (obj and len(obj) > 0):
			direction = obj[0].rec_direction
			#delete this record
			obj[0].delete()
			self.response.out.write('{"viewport_dir": "%s"}' % direction)
		else:
			self.response.out.write('{"status": "unable to get data by id"}')
Beispiel #2
0
	def get(self,id,dir):
		self.response.headers['Content-Type'] = 'application/json; charset=utf-8'
		if (id and dir):
			#lets see if we already have record by the same ID
			obj = datahandler.getData(id)
			if (obj and len(obj) > 0):
				obj[0].delete()
			#store new direction
			datahandler.putData(id, dir)
			#output to the browser
			self.response.out.write('{"status": "stored successfully"}')
		else:
			self.response.out.write('{"status": "invalid id or direction"}')