Пример #1
0
def createNewUser(fname, lname, email):
	newUser = UserProfile.getFromEmail(email)
	if newUser == None:
		newUser = UserProfile(id=email, fname=fname, lname=lname, email=email)
		newUser.put()
		logging.info('User %s created.' % email)
	else:
		logging.error('User already exists.')
Пример #2
0
	def post(self):
		user = users.get_current_user()
		profileId = self.request.get('profileId')
		userProfile = UserProfile.getFromEmail(profileId)
		if userProfile is None or canEditThisProfile == False:
			self.abort(404)
		user_profile_json = {}
		for field in UserProfile.getJsonFields():
			user_profile_json[field] = self.request.get(field)
		userProfile.profile = json.dumps(user_profile_json)
		userProfile.put()
		self.redirect('/profile?user_email=%s' % profileId)
Пример #3
0
 def post(self):
     user = users.get_current_user()
     profileId = self.request.get('profileId')
     userProfile = UserProfile.getFromEmail(profileId)
     if userProfile is None or canEditThisProfile == False:
         self.abort(404)
     user_profile_json = {}
     for field in UserProfile.getJsonFields():
         user_profile_json[field] = self.request.get(field)
     userProfile.profile = json.dumps(user_profile_json)
     userProfile.put()
     self.redirect('/profile?user_email=%s' % profileId)
Пример #4
0
	def get(self):
		if self.request.get('user_email'):
			userProfile = UserProfile.getFromEmail(self.request.get('user_email'))
			if userProfile is None:
				self.abort(404)
		else:
			userProfile = getMyProfile()
		(template_data, template) = get_template('templates/profile.html')
		userProfileData = {}
		profile_data = json.loads(userProfile.profile) if userProfile.profile else {}
		for field in UserProfile.getJsonFields():
			userProfileData[field] = profile_data.setdefault(field, '')
		template_data['user'] = userProfile
		template_data['user_profile'] = userProfileData
		template_data['profileId'] = userProfile.email
		template_data['readonly'] = not(canEditThisProfile(userProfile))
		self.response.out.write(template.render(template_data))
Пример #5
0
 def get(self):
     if self.request.get('user_email'):
         userProfile = UserProfile.getFromEmail(
             self.request.get('user_email'))
         if userProfile is None:
             self.abort(404)
     else:
         userProfile = getMyProfile()
     (template_data, template) = get_template('templates/profile.html')
     userProfileData = {}
     profile_data = json.loads(
         userProfile.profile) if userProfile.profile else {}
     for field in UserProfile.getJsonFields():
         userProfileData[field] = profile_data.setdefault(field, '')
     template_data['user'] = userProfile
     template_data['user_profile'] = userProfileData
     template_data['profileId'] = userProfile.email
     template_data['readonly'] = not (canEditThisProfile(userProfile))
     self.response.out.write(template.render(template_data))