示例#1
0
	def get(self):
		todo = self.request.get('getname');
		
		if (todo == 'true'):
			if (self.request.headers.get('Referer') != None):
				# stop others from stealing your bandwidth
				#if (self.request.headers.get('Referer').find('web2hunter.appspot.com')!=-1):

					# return a possible domain name
					possiblename = WH.genName()
			
					while (possiblename == ""):
						possiblename = WH.genName()
			
					# lets sanitize the possible name
					# for sometime we get the response header for some reason -
					# Content-Type: text/html; charset=utf-8 Cache-Control: ... blabla
					# well a foo.split()[-1] would help

					# food for javascript + sanitization
					self.response.out.write (possiblename.split()[-1])
				#else:
					#self.response.out.write ("nothing for you");
			else:
				self.response.out.write ("nothing for you");
		else:
			# render the template
			outstr = template.render (
				self.tPath + '/index.html', None )
	
			self.response.out.write (outstr)