当前位置: 首页>>代码示例>>Python>>正文


Python User.is_deleted方法代码示例

本文整理汇总了Python中indico.modules.users.User.is_deleted方法的典型用法代码示例。如果您正苦于以下问题:Python User.is_deleted方法的具体用法?Python User.is_deleted怎么用?Python User.is_deleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在indico.modules.users.User的用法示例。


在下文中一共展示了User.is_deleted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_deletion_no_primary_email

# 需要导入模块: from indico.modules.users import User [as 别名]
# 或者: from indico.modules.users.User import is_deleted [as 别名]
def test_deletion_no_primary_email():
    # this tests setting the is_deleted property on a user with no primary email
    # very unlikely case but let's make sure we never try to set the deleted
    # flag on a None primary email.
    user = User()
    assert user.email is None
    user.is_deleted = True
开发者ID:DirkHoffmann,项目名称:indico,代码行数:9,代码来源:users_test.py

示例2: test_deletion

# 需要导入模块: from indico.modules.users import User [as 别名]
# 或者: from indico.modules.users.User import is_deleted [as 别名]
def test_deletion(db):
    user = User(first_name='Guinea', last_name='Pig', email='[email protected]', secondary_emails=['[email protected]'])
    db.session.add(user)
    db.session.flush()
    assert not user.is_deleted
    assert all(not ue.is_user_deleted for ue in user._all_emails)
    user.is_deleted = True
    db.session.flush()
    assert all(ue.is_user_deleted for ue in user._all_emails)
开发者ID:DirkHoffmann,项目名称:indico,代码行数:11,代码来源:users_test.py

示例3: _user_from_avatar

# 需要导入模块: from indico.modules.users import User [as 别名]
# 或者: from indico.modules.users.User import is_deleted [as 别名]
 def _user_from_avatar(self, avatar, **kwargs):
     email = sanitize_email(convert_to_unicode(avatar.email).lower().strip())
     secondary_emails = {sanitize_email(convert_to_unicode(x).lower().strip()) for x in avatar.secondaryEmails}
     secondary_emails = {x for x in secondary_emails if x and is_valid_mail(x, False) and x != email}
     # we handle deletion later. otherwise it might be set before secondary_emails which would
     # result in those emails not being marked as deleted
     is_deleted = kwargs.pop('is_deleted', False)
     user = User(id=int(avatar.id),
                 email=email,
                 first_name=convert_to_unicode(avatar.name).strip() or 'UNKNOWN',
                 last_name=convert_to_unicode(avatar.surName).strip() or 'UNKNOWN',
                 title=USER_TITLE_MAP.get(avatar.title, UserTitle.none),
                 phone=convert_to_unicode(avatar.telephone[0]).strip(),
                 affiliation=convert_to_unicode(avatar.organisation[0]).strip(),
                 address=convert_to_unicode(avatar.address[0]).strip(),
                 secondary_emails=secondary_emails,
                 is_blocked=avatar.status == 'disabled',
                 **kwargs)
     if is_deleted or not is_valid_mail(user.email):
         user.is_deleted = True
     return user
开发者ID:fph,项目名称:indico,代码行数:23,代码来源:users.py


注:本文中的indico.modules.users.User.is_deleted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。