本文整理汇总了Python中pybossa.model.user.User.info['google_token']方法的典型用法代码示例。如果您正苦于以下问题:Python User.info['google_token']方法的具体用法?Python User.info['google_token']怎么用?Python User.info['google_token']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybossa.model.user.User
的用法示例。
在下文中一共展示了User.info['google_token']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: manage_user
# 需要导入模块: from pybossa.model.user import User [as 别名]
# 或者: from pybossa.model.user.User import info['google_token'] [as 别名]
def manage_user(access_token, user_data):
"""Manage the user after signin"""
# We have to store the oauth_token in the session to get the USER fields
user = user_repo.get_by(google_user_id=user_data['id'])
google_token = dict(oauth_token=access_token)
# user never signed on
if user is None:
info = dict(google_token=google_token)
name = username_from_full_name(user_data['name'])
user = user_repo.get_by_name(name)
email = user_repo.get_by(email_addr=user_data['email'])
if ((user is None) and (email is None)):
user = User(fullname=user_data['name'],
name=name,
email_addr=user_data['email'],
google_user_id=user_data['id'],
info=info)
user_repo.save(user)
if newsletter.is_initialized():
newsletter.subscribe_user(user)
return user
else:
return None
else:
user.info['google_token'] = google_token
# Update the name to fit with new paradigm to avoid UTF8 problems
if type(user.name) == unicode or ' ' in user.name:
user.name = username_from_full_name(user.name)
user_repo.save(user)
return user