當前位置: 首頁>>代碼示例>>Python>>正文


Python UserMgr.get_list方法代碼示例

本文整理匯總了Python中bookie.models.auth.UserMgr.get_list方法的典型用法代碼示例。如果您正苦於以下問題:Python UserMgr.get_list方法的具體用法?Python UserMgr.get_list怎麽用?Python UserMgr.get_list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bookie.models.auth.UserMgr的用法示例。


在下文中一共展示了UserMgr.get_list方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: accounts_invites

# 需要導入模塊: from bookie.models.auth import UserMgr [as 別名]
# 或者: from bookie.models.auth.UserMgr import get_list [as 別名]
def accounts_invites(request):
    """Return a list of the accounts that aren't activated."""
    user_list = UserMgr.get_list()
    ret = {
        'users': [(u.username, u.invite_ct) for u in user_list],
    }
    return ret
開發者ID:cambot,項目名稱:Bookie,代碼行數:9,代碼來源:api.py

示例2: login

# 需要導入模塊: from bookie.models.auth import UserMgr [as 別名]
# 或者: from bookie.models.auth.UserMgr import get_list [as 別名]
def login(request):
    """Login the user to the system

    If not POSTed then show the form
    If error, display the form with the error message
    If successful, forward the user to their /recent

    Note: the came_from stuff we're not using atm. We'll clean out if we keep
    things this way

    """
    login_url = route_url("login", request)
    referrer = request.url
    if referrer == login_url:
        referrer = u"/"  # never use the login form itself as came_from

    came_from = request.params.get("came_from", referrer)

    message = u""
    login = u""
    password = u""

    if "form.submitted" in request.params:
        login = request.params["login"]
        password = request.params["password"]

        LOG.debug(login)
        auth = UserMgr.get(username=login)
        LOG.debug(auth)
        LOG.debug(UserMgr.get_list())

        if auth and auth.validate_password(password) and auth.activated:
            # We use the Primary Key as our identifier once someone has
            # authenticated rather than the username.  You can change what is
            # returned as the userid by altering what is passed to remember.
            headers = remember(request, auth.id, max_age=60 * 60 * 24 * 30)
            auth.last_login = datetime.utcnow()

            # log the successful login
            AuthLog.login(login, True)

            # we're always going to return a user to their own /recent after a
            # login
            return HTTPFound(location=request.route_url("user_bmark_recent", username=auth.username), headers=headers)

        # log the right level of problem
        if auth and not auth.validate_password(password):
            message = "Your login attempt has failed."
            AuthLog.login(login, False, password=password)

        elif auth and not auth.activated:
            message = "User account deactivated. Please check your email."
            AuthLog.login(login, False, password=password)
            AuthLog.disabled(login)

        elif auth is None:
            message = "Failed login"
            AuthLog.login(login, False, password=password)

    return {"message": message, "came_from": came_from, "login": login, "password": password}
開發者ID:EdwardNavarro,項目名稱:Bookie,代碼行數:62,代碼來源:auth.py

示例3: accounts_inactive

# 需要導入模塊: from bookie.models.auth import UserMgr [as 別名]
# 或者: from bookie.models.auth.UserMgr import get_list [as 別名]
def accounts_inactive(request):
    """Return a list of the accounts that aren't activated."""
    user_list = UserMgr.get_list(active=False)
    ret = {
        'count': len(user_list),
        'users': [dict(h) for h in user_list],
    }
    return ret
開發者ID:cambot,項目名稱:Bookie,代碼行數:10,代碼來源:api.py

示例4: _get_userlist

# 需要導入模塊: from bookie.models.auth import UserMgr [as 別名]
# 或者: from bookie.models.auth.UserMgr import get_list [as 別名]
def _get_userlist(args):
    """Fetch a list of users from the system and output to stdout"""
    _init_sql(args)

    for user in UserMgr.get_list():
        print("{0:<10} {1:<20} {2:<50}".format(
            user.username,
            user.name,
            user.email))
開發者ID:cambot,項目名稱:Bookie,代碼行數:11,代碼來源:usermgr.py

示例5: user_list

# 需要導入模塊: from bookie.models.auth import UserMgr [as 別名]
# 或者: from bookie.models.auth.UserMgr import get_list [as 別名]
def user_list(request):
    """Provide list of users in the system.

    Supported Query params: order, limit
    """
    params = request.params
    order = params.get('order', None)
    limit = params.get('limit', None)
    user_list = UserMgr.get_list(order=order, limit=limit)
    ret = {
        'count': len(user_list),
        'users': [dict(h) for h in user_list],
    }
    return _api_response(request, ret)
開發者ID:BraindeadCrew,項目名稱:Bookie,代碼行數:16,代碼來源:api.py

示例6: test_activation_delete

# 需要導入模塊: from bookie.models.auth import UserMgr [as 別名]
# 或者: from bookie.models.auth.UserMgr import get_list [as 別名]
    def test_activation_delete(self):
        """Make sure removing an activation does not remove a user."""
        tst = User()
        tst.username = gen_random_word(10)
        tst.activation = Activation(u'signup')
        DBSession.add(tst)
        DBSession.flush()

        DBSession.delete(tst.activation)

        users = UserMgr.get_list()

        # We still have the admin user as well so the count is two.
        self.assertEqual(
            2,
            len(users),
            'We should have a total of 2 users still: ' + str(len(users)))
開發者ID:BraindeadCrew,項目名稱:Bookie,代碼行數:19,代碼來源:test_model.py

示例7: test_activation_cascade

# 需要導入模塊: from bookie.models.auth import UserMgr [as 別名]
# 或者: from bookie.models.auth.UserMgr import get_list [as 別名]
    def test_activation_cascade(self):
        """Removing a user cascades the activations as well."""
        tst = User()
        tst.username = gen_random_word(10)
        tst.activation = Activation('signup')
        DBSession.add(tst)
        DBSession.flush()

        DBSession.delete(tst)

        users = UserMgr.get_list()

        # We still have the admin user as well so the count is one.
        eq_(
            1,
            len(users),
            'We should have a total of 1 user still: ' + str(len(users)))

        activations = DBSession.query(Activation).all()
        eq_(0, len(activations), 'There should be no activations left')
開發者ID:Cfhansen,項目名稱:Bookie,代碼行數:22,代碼來源:test_model.py


注:本文中的bookie.models.auth.UserMgr.get_list方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。