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


Python User.view方法代碼示例

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


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

示例1: deleted_users

# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def deleted_users():
    from mygpo.users.models import User
    users = User.view('users/deleted',
            include_docs = True,
            reduce       = False,
        )
    return list(users)
開發者ID:fk-lx,項目名稱:mygpo,代碼行數:9,代碼來源:user.py

示例2: handle

# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
    def handle(self, *args, **options):

        users = User.view("users/deleted", include_docs=True, reduce=False)

        total = User.view("users/deleted", reduce=True)

        total = list(total)[0]["value"] if total else 0

        for n, user in enumerate(users):

            if user.is_active or not user.deleted:
                print "skipping", user.username

            print "deleting", user.username,
            user.delete()

            progress(n + 1, total)
開發者ID:Mic92,項目名稱:mygpo,代碼行數:19,代碼來源:cleanup-unused-users.py

示例3: user_agent_stats

# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def user_agent_stats():
    from mygpo.users.models import User
    res = User.view('clients/by_ua_string',
        wrap_doc    = False,
        group_level = 1,
        stale       = 'update_after',
    )

    return Counter(dict((r['key'], r['value']) for r in res))
開發者ID:fk-lx,項目名稱:mygpo,代碼行數:11,代碼來源:user.py

示例4: get_entries

# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
    def get_entries(self):
        if self._useragents is None:
            res = User.view('clients/by_ua_string',
                wrap_doc    = False,
                group_level = 1,
                stale       = 'update_after',
            )

            self._useragents = Counter(dict((r['key'], r['value']) for r in res))

        return self._useragents
開發者ID:Mic92,項目名稱:mygpo,代碼行數:13,代碼來源:clients.py

示例5: user_by_google_email

# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def user_by_google_email(email):
    """ Get a user by its connected Google account """

    from mygpo.users.models import User
    users = User.view('users/by_google_email',
            key          = email,
            include_docs = True,
        )

    if not users:
        return None

    return users.one()
開發者ID:fk-lx,項目名稱:mygpo,代碼行數:15,代碼來源:user.py

示例6: deleted_user_count

# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def deleted_user_count():
    from mygpo.users.models import User
    total = User.view('users/deleted',
            reduce = True,
        )
    return list(total)[0]['value'] if total else 0
開發者ID:fk-lx,項目名稱:mygpo,代碼行數:8,代碼來源:user.py


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