本文整理汇总了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)
示例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)
示例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))
示例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
示例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()
示例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