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


Python User.find_by_email方法代码示例

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


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

示例1: lost

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import find_by_email [as 别名]
def lost(request, response):
    """Generates lost password email messages"""
    email = request.POST.get('email')
    username = request.POST.get('username')
    if username:
        user = User.find_user(username)
        if not user:
            raise BadRequest("Unknown user: " + username)
            
        verify_code = _get_password_verify_code(user)
        change_url = c.base_url + "?pwchange=%s;%s" % (username, verify_code)
        context = dict(username=username, base_url=c.base_url,
                        change_url=change_url)
        
        send_email_template(user.email, "Requested password change for " + c.base_url,
                            "lost_password.txt", context)
        
    elif email:
        users = User.find_by_email(email)
        context = dict(email=email,
            usernames=[dict(username=user.username) for user in users],
            base_url=c.base_url)
        send_email_template(email, "Your username for " + c.base_url,
                            "lost_username.txt", context)
    else:
        raise BadRequest("Username or email is required.")
        
    return response()
开发者ID:Jangts,项目名称:bespin,代码行数:30,代码来源:controllers.py

示例2: test_create_new_user

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import find_by_email [as 别名]
def test_create_new_user():
    s = _get_session(True)
    num_users = s.query(User).count()
    assert num_users == 0
    user = User.create_user("BillBixby", "hulkrulez", "[email protected]")
    assert len(user.uuid) == 36
    num_users = s.query(User).count()
    assert num_users == 1
    
    users = User.find_by_email("[email protected]")
    assert users[0].username == "BillBixby"
开发者ID:Jangts,项目名称:bespin,代码行数:13,代码来源:test_users.py

示例3: test_create_new_user

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import find_by_email [as 别名]
def test_create_new_user():
    s = _get_session(True)
    num_users = s.query(User).count()
    assert num_users == 0
    user = User.create_user("BillBixby", "hulkrulez", "[email protected]")
    assert len(user.uuid) == 36
    num_users = s.query(User).count()
    assert num_users == 1
    result = s.connection().execute(EventLog.select()).fetchall()
    assert len(result) == 1
    
    users = User.find_by_email("[email protected]")
    assert users[0].username == "BillBixby"
    assert len(users) == 1
    
    user = User.find_user("[email protected]")
    assert user == users[0]
开发者ID:mozilla,项目名称:bespinserver,代码行数:19,代码来源:test_users.py


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