Ejemplo n.º 1
0
def updateProfile(profileVO):
	user = users.get_current_user()
	
	if user:
		# Does the profile already exist?
		if profileVO.key == None:
			# No, create a new profile.
			profile = UserProfile()
			#logging.info("Creating a new profile!")
		else:
			# Yes, get the existing profile from the data store.
			profile = UserProfile.get(profileVO.key)
			#logging.debug("Updating existing profile...")
			
		# Update and save the profile.
		profile.user = user
		profile.name = profileVO.name
		profile.url = profileVO.url
		
		try:
			profile.description = profileVO.description
		except AttributeError:
			#logging.info("Profile description was empty, so we're skipping it.")
			pass

		profile.save()
			
		return {'name': profile.name, 'url': profile.url, 'description': profile.description, 'key': profileVO.key}
	
	return False