本文整理汇总了Python中accounts.models.Account.public_url方法的典型用法代码示例。如果您正苦于以下问题:Python Account.public_url方法的具体用法?Python Account.public_url怎么用?Python Account.public_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类accounts.models.Account
的用法示例。
在下文中一共展示了Account.public_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_connection_and_finish_user
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import public_url [as 别名]
def process_connection_and_finish_user(self, user, user_info):
"""
Delegates to helpers to process rest of User, adds Account, maps positions
Return: User
"""
## add LI account
acct = Account()
acct.owner = user
acct.service = 'linkedin'
acct.uniq_id = user_info['id']
if 'publicProfileUrl' in user_info:
acct.public_url = user_info['publicProfileUrl']
acct.status = 'unlinked'
acct.save()
## Edge case that showed up in production
if 'publicProfileUrl' not in user_info:
return user
## parse public page
self.process_public_page_existing(user_info['publicProfileUrl'], user)
## Map Positions
# match all positions to ideals
for p in user.positions.all():
careerlib.match_position_to_ideals(p)
# process first_ideal_position
user.profile.set_first_ideal_job()
return user
示例2: add_dormant_user
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import public_url [as 别名]
def add_dormant_user(self,user_info):
# create dormant user account
temp_username = user_info['firstName'] + user_info['lastName'] + user_info['id']
temp_username = temp_username[:30]
# self.stdout.write(temp_username)
user = User()
user.username = temp_username
user.save()
# create user profile
user.profile.first_name = user_info['firstName']
user.profile.last_name = user_info['lastName']
if 'headline' in user_info:
user.profile.headline = user_info['headline']
user.profile.status = "dormant"
user.profile.save()
# add pofile picture
if 'pictureUrl' in user_info:
self.add_profile_pic(user,user_info['pictureUrl'])
# create LinkedIn account
acct = Account()
acct.owner = user
acct.service = 'linkedin'
acct.uniq_id = user_info['id']
if 'publicProfileUrl' in user_info:
acct.public_url = user_info['publicProfileUrl']
acct.status = "unlinked"
acct.save()
return user
示例3: add_dormant_user
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import public_url [as 别名]
def add_dormant_user(self,user_info):
# compile temporary user name
temp_username = user_info['firstName'] + user_info['lastName'] + user_info['id']
temp_username = temp_username[:30]
# check to see if user already exists
try:
user = User.objects.get(username=temp_username)
except ObjectDoesNotExist:
# create dormant user account
user = User()
user.username = temp_username
user.is_active = False
user.save()
# create user profile
user.profile.first_name = user_info['firstName']
user.profile.last_name = user_info['lastName']
if 'headline' in user_info:
user.profile.headline = user_info['headline']
user.profile.status = "dormant"
user.profile.save()
# add pofile picture
if 'pictureUrl' in user_info:
self.add_profile_pic(user,user_info['pictureUrl'])
# create LinkedIn account
acct = Account()
acct.owner = user
acct.service = 'linkedin'
acct.uniq_id = user_info['id']
if 'publicProfileUrl' in user_info:
acct.public_url = user_info['publicProfileUrl']
acct.status = "unlinked"
acct.save()
if self.logging:
print 'Add Dormant User: ' + user_info['firstName'] + ' ' + user_info['lastName']
return user
示例4: process_connection_and_create_user
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import public_url [as 别名]
def process_connection_and_create_user(self, user_info):
"""
Delegates to helpers to try and create User object. If successful, creates Account object, maps positions.
Return: User || None
"""
## Edge case that showed up in production
if 'publicProfileUrl' not in user_info:
return None
## go to purl, parse, create user, profile, return user
user = self.process_public_page_full(user_info['publicProfileUrl'], user_info['id'])
if user is not None:
## Add picture url from user_info b/c not crawlable
if 'pictureUrl' in user_info:
self.add_profile_pic(user, user_info['pictureUrl'])
## Create account
acct = Account()
acct.owner = user
acct.service = 'linkedin'
acct.uniq_id = user_info['id']
if 'publicProfileUrl' in user_info:
acct.public_url = user_info['publicProfileUrl']
acct.status = "unlinked"
acct.save()
## Match Positions
# match all positions to ideals
for p in user.positions.all():
careerlib.match_position_to_ideals(p)
# process first_ideal_position
user.profile.set_first_ideal_job()
return user
else:
return None