Example #1
0
	def get(self, key):
		# foldman = models.Foldman.get(key)
		
		if key == 'new':
			foldman = models.create_foldman(self.current_user)
		else:
			foldman = models.Foldman.get(key)
			if foldman:
				if foldman.active == False:
					models.block_foldman(foldman)
				if foldman.current_part and foldman.current_part.fb_uid == self.current_user.id:
					models.block_foldman(foldman)
		
		if foldman and foldman.finished != None:
			self.redirect(foldman.get_url())
			return

		
		if foldman and (foldman.previous_part == None or foldman.previous_part.user.id != self.current_user.id):
			part = models.get_current_part(foldman)
			if part and part.finished == None:
				template_values = {
					'foldman': foldman,
					'part': part
				}
				self.render(template_values,'canvas.html')
			else:
				self.response.set_status(404, 'Not Found')
		else:
			self.response.set_status(404, 'Not Found')
			self.render({},'404.html')
Example #2
0
	def post(self, action, key):
		foldman = models.Foldman.get(key)
		if foldman: 
			if(action == 'active'):
				models.block_foldman(foldman)
			elif(action == 'cancel'):
				models.unblock_foldman(foldman)
			elif(action == 'decline'):
				models.decline_foldman(foldman, self.current_user)
				self.redirect('/')
			else:
				self.error(404)
		else:
			self.error(404)