예제 #1
0
	def delete(self, project_id = None):
		# lookup user's auth info
		user_info = User.get_by_id(long(self.user_id))
		
		# pull the entry from the db
		project = Project.get_by_id(long(project_id))

		# if we found it and own it
		if project and project.owner == user_info.key:
			# patch all wisps using project to stock
			Wisp.patch_to_stock(project.key)

			# delete the project
			project.key.delete()

			self.add_message('Project successfully deleted!', 'success')
		else:
			self.add_message('Project was not deleted.  Something went horribly wrong somewhere!', 'warning')

		# hangout for a second
		time.sleep(1)

		# use the channel to tell the browser we are done and reload
		channel_token = self.request.get('channel_token')
		channel.send_message(channel_token, 'reload')
		return