user.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:fluiddb 作者: fluidinfo 项目源码 文件源码
def createUser(username, password, fullname, email, role):
    """Create a new L{User}.

    @param username: A C{unicode} username for the user.
    @param password: A C{unicode} password in plain text for the user. The
        password will be hashed before being stored.
    @param fullname: A C{unicode} name for the user.
    @param email: The C{unicode} email address for the user.
    @param role: The L{Role} for the user.
    @return: A C{list} of C{(objectID, username)} 2-tuples for the new
        L{User}s.
    """
    username = username.lower()
    users = UserAPI()
    result = users.create([(username, password, fullname, email)])
    # Set the role with an update to ensure that the 'fluiddb/users/role' tag
    # value is set correctly.
    users.set([(username, None, None, None, role)])
    try:
        transaction.commit()
    except:
        transaction.abort()
        raise
    return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号