Beispiel #1
0
  def get(self):
	user = users.get_current_user()
	
	if user:
		times = Time.gql("where author = :1 order by date desc limit 10", user)
		self.response.out.write(template.render("timer.html", { 'times': times, 'username' : user.nickname(), 
															    'logout' : users.create_logout_url("/") }))
	else:
		self.redirect(users.create_login_url(self.request.uri))
Beispiel #2
0
	def post(self):
		user = users.get_current_user()

		if not user:
			self.response.set_status(401)
			self.response.out.write("Not authorized")
		
		times = Time.gql("where author = :1", user)
		
		db.delete(times)
		
		self.response.out.write("Ok.")
Beispiel #3
0
  def get(self):
	user = users.get_current_user() 

	if not user:
		self.response.set_status(401)
		self.response.out.write("Not authorized")
	
	times = Time.gql("where author = :1 order by date desc limit 1", user)
	
	xml = "<times>"
	
	data_template = "<data time='%.2f' date='%s' key='%s' />"
	
	for time in times:
		xml += data_template % (float(time.time) / 1000, time.date, time.key())
		
	xml += "</times>"
	
	self.response.headers['Content-Type'] = 'application/xml'
	self.response.set_status(200)
	self.response.out.write(xml)