Exemple #1
0
	def post(self, workspace, action):
		#logging.info("hello world")
		##used for CRUD for tasks and dnd operations
		#if action not in self.__actions__:
		#	raise WrongActionException("Action %s is not supported" % action)
		#if action != "create" and not id:
		#	raise WrongActionException("Id should not be null for %s action" % action)
		logging.info("============= Doing %s ===============" % action)
		if action == "create":
			name = self.request.get("name")
			body = self.request.get("body")
			column = Column.gql("WHERE allow_create=TRUE").get()
			logging.info("column: %s, name: %s, body: %s" % (column, name, body))
			task = Task(column=column, name=unicode(name), body=unicode(body))
			task.put()
		if action == "dnd":
			task_id = self.request.get("task")
			dest_column_key = self.request.get("to")
			logging.info("task: %s" % task_id)
			logging.info("to: %s" % dest_column_key)

			task = Task.get(task_id)
			dest_column = Column.get(dest_column_key)
			task.column = dest_column
			task.put()
		if action == "delete":
		#	#delete task
			id = self.request.get("taskId")
			task = Task.get(id)
			db.delete(task)
		if action == "edit":
			id = self.request.get("taskId")
			name = self.request.get("name")
			body = self.request.get("body")
			task = Task.get(id)
			task.name = name
			task.body = body
			task.put()