本文整理汇总了Python中social_auth.models.UserSocialAuth.delete_associations方法的典型用法代码示例。如果您正苦于以下问题:Python UserSocialAuth.delete_associations方法的具体用法?Python UserSocialAuth.delete_associations怎么用?Python UserSocialAuth.delete_associations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类social_auth.models.UserSocialAuth
的用法示例。
在下文中一共展示了UserSocialAuth.delete_associations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getAssociation
# 需要导入模块: from social_auth.models import UserSocialAuth [as 别名]
# 或者: from social_auth.models.UserSocialAuth import delete_associations [as 别名]
def getAssociation(self, server_url, handle=None):
"""Return stored assocition"""
oid_associations = UserSocialAuth.get_oid_associations(server_url,
handle)
associations = [association
for assoc_id, association in oid_associations
if association.getExpiresIn() > 0]
expired = [assoc_id for assoc_id, association in oid_associations
if association.getExpiresIn() == 0]
if expired: # clear expired associations
UserSocialAuth.delete_associations(expired)
if associations: # return most recet association
return associations[0]