示例#1
0
	def get_basic_data_by_account_id(self, accountID='', simple='', userID=''):
		theBasics = {}
		if accountID:
			from Profile import Profile
			profileObj = Profile(self.db)
			profile = profileObj.get_profile_by_account_id(accountID)
			if not simple:
				query = self.db.user_data.user_id == userID
				nickName = self.db(query).select().first()
				query1 = self.db.account.id == accountID
				defaults = self.db(query1).select().first()
				if nickName:
					theBasics['name'] = nickName.nick_name
				if defaults:
					theBasics['friend'] = defaults.default_friend
					theBasics['blog'] = defaults.default_blog
				if profile:
					theBasics['backgroundImg'] = profile['backgroundImg']
					theBasics['profileTag'] = profile['tagLine']

			if profile:
				theBasics['profileName'] = profile['name']
				theBasics['profileImg'] = profile['profileImg']
				theBasics['accountKey'] = self.get_account_key_by_account_id(accountID)

			return theBasics

		else:
			return False
示例#2
0
	def get_available_accounts(self, userID):
		accounts = []
		if userID:
			accountID = self.get_account_id_by_user_id(userID)
			if accountID:
				query = self.db.account.id != accountID
				results = self.db(query).select(self.db.account.id, self.db.account.account_id)
				if results:
					for result in results:
						dataset = {}
						dataset['key'] = result.account_id
						from Profile import Profile
						profileObj = Profile(self.db)
						profile = profileObj.get_profile_by_account_id(result.id)
						if profile:
							dataset['profileName'] = profile['name']
							dataset['profileTag'] = profile['tagLine']
							dataset['profileImg'] = profile['profileImg']
							dataset['backgroundImg'] = profile['backgroundImg']

						accounts.append(dataset)

		return accounts