Example #1
0
	def get(self):

		template_values = {
			#'pilots_online': self.get_pilots()
		}
		query = db.GqlQuery("SELECT * FROM  Aero where aero = :1", self.request.get("aero")) 
		#results = query.fetch(10)
		#c =  query.count()
		foo  ={}
		#print results
		aero = query.get()
		#for res in results:
		#	foo[res.aero] = "foo"
		if not aero:
			x =  "create"
			aero = Aero()
			aero.aero = self.request.get("aero")
		else:
			#x = "edit"
			pass
		aero.author = self.request.get("author")
		aero.description = self.request.get("description")
		aero.status = self.request.get("status")
		aero.fdm = self.request.get("flight-model")
		aero.splash = self.request.get("splash")
		aero.version = self.request.get("version")
		aero.put()

		#print 'Content-Type: text/plain'
		#print ''
		#print json.dumps(self.get_pilots())
		#path = os.path.join(os.path.dirname(__file__), 'templates/pilots_online.html')
		self.response.out.write(json.dumps(foo))
	def post(self):

		template_values = {
			#'pilots_online': self.get_pilots()
		}
		query = db.GqlQuery("SELECT * FROM  Aero where aero = :1", self.request.get("aero")) 
		aero = query.get()
		if not aero:
			x =  "add"
			aero = Aero()
			aero.aero = self.request.get("aero")
			aero.author = self.request.get("author")
			aero.directory = self.request.get("directory")
			aero.description = self.request.get("description")
			aero.status = self.request.get("status")
			aero.fdm = self.request.get("flight-model")
			aero.splash = self.request.get("splash")
			aero.version = self.request.get("version")
			aero.splash = self.request.get("splash")
			aero.put()
		else:
			x = "edit"
			pass



		reply = {'success': True, 'status': x}
		#print 'Content-Type: text/plain'
		#print ''
		#print json.dumps(self.get_pilots())
		#path = os.path.join(os.path.dirname(__file__), 'templates/pilots_online.html')
		self.response.out.write(json.dumps(reply))