Ejemplo n.º 1
0
	def get(self, username, name):
		adata	= UserData.load_from_nickname(username)
		author		= adata.user
		page_admin 	= self.page_admin(author)

		name		= urllib.unquote_plus(urllib.unquote(name))
		unix_name 	= utils.unix_string(name)

		context = self.context
		context['author'] = author
		context['page_author'] = adata
		context['page_admin'] = page_admin

		# Check to see if we already have a profile for that character.
		# profile = Profile.gql('WHERE unix_name = :name AND author = :author',
		#					  name=unix_name, author=adata).get()
		profile = Profile.get_by_key_name(
			stores.Profile.key_name_form % (unix_name, adata.key_name)
		)

		# If we can't find that character and we're the author we may want to
		# make it, other wise we should move the user back to the user page.
		if not profile or (not profile.public and not page_admin):
			self.flash.msg = "Unknown Profile: %s" % name
			if author == self.user:
				self.redirect('/create/profile/?name=%s' % name)
			else:
				self.redirect(adata.url)
			return

		context['profile'] = profile

		self.render(['edit', 'editprofile'])
Ejemplo n.º 2
0
	def get(self, username, name):
		adata	= UserData.load_from_nickname(username)
		author		= adata.user
		page_admin 	= self.page_admin(author)

		name		= urllib.unquote_plus(urllib.unquote(name))
		unix_name 	= utils.unix_string(name)

		context = self.context
		context['author'] = author
		context['page_author'] = adata
		context['page_admin'] = page_admin

		# Check to see if we already have a profile for that character.
		profile = Profile.get_by_key_name(
			stores.Profile.key_name_form % (unix_name, adata.key_name)
		)

		# If we can't find that character and we're the author we may want to
		# make it, other wise we should move the user back to the user page.
		if not profile or (not profile.public and not page_admin):
			self.flash.msg = "Unknown Profile: %s" % name
			self.redirect(Profile.get_url(username))
			return

		context['profile'] = profile

		self.render(['delete', 'deleteprofile'], context)
Ejemplo n.º 3
0
	def get(self):
		logging.info('PROFILE KEY: %r' % self.request.get('profile_key'))
		profile		= Profile.get_by_key_name(self.request.get('profile_key'))
		world 		= World.get_by_key_name(self.request.get('world_key'))

		if not profile:
			self.flash.msg = "Error: Unable to load profile"
			self.redirect('/')
			return

		if not world:
			self.flash.msg = "Error: Unable to load World"
			self.redirect('/')
			return

		page_admin = utils.page_admin(profile.author.user)
		if not page_admin:
			self.flash.msg = "Access Denied"
			self.redirect(self.request.headers['REFERER'])
			return

		self.remove_profile(world, profile)

		self.flash.msg = "Profile: %s removed from World: %s" % (profile.name, world.name)
		self.redirect(profile.url)