本文整理汇总了Python中rogerthat.rpc.models.Mobile.all方法的典型用法代码示例。如果您正苦于以下问题:Python Mobile.all方法的具体用法?Python Mobile.all怎么用?Python Mobile.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rogerthat.rpc.models.Mobile
的用法示例。
在下文中一共展示了Mobile.all方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from rogerthat.rpc.models import Mobile [as 别名]
# 或者: from rogerthat.rpc.models.Mobile import all [as 别名]
def get(self):
now_ = now()
yesterday = datetime.datetime.fromtimestamp(now_ - 24 * 3600)
cleanup_size = 0
mobiles = Mobile.all().filter("status =", Mobile.STATUS_NEW | Mobile.STATUS_ACCOUNT_CREATED).filter("timestamp <", yesterday)
for mobile in mobiles:
if mobile.status >= Mobile.STATUS_ACCOUNT_CREATED:
delete_xmpp_account(mobile.account , mobile.key())
else:
mobile.delete()
logging.info("Cleanup %s timedout unfinished registration Mobile records" % cleanup_size)
mobiles = Mobile.all().filter("status =", Mobile.STATUS_NEW | Mobile.STATUS_ACCOUNT_CREATED | Mobile.STATUS_REGISTERED | Mobile.STATUS_DELETE_REQUESTED | Mobile.STATUS_UNREGISTERED)
cleanup_size = self._cleanup_mobiles(mobiles)
mobiles = Mobile.all().filter("status =", Mobile.STATUS_NEW | Mobile.STATUS_ACCOUNT_CREATED | Mobile.STATUS_REGISTERED | Mobile.STATUS_DELETE_REQUESTED).filter("timestamp <", yesterday)
cleanup_size += self._cleanup_mobiles(mobiles)
logging.info("Cleanup %s to be deleted mobile records" % cleanup_size)
示例2: user_statistic
# 需要导入模块: from rogerthat.rpc.models import Mobile [as 别名]
# 或者: from rogerthat.rpc.models.Mobile import all [as 别名]
def user_statistic():
qry1 = Mobile.all(keys_only=True).filter('status >=', 4).filter('status <', 8)
qry2 = FriendServiceIdentityConnection.all(keys_only=True)
qry3 = ServiceIdentity.all(keys_only=True)
qries = [ qry1, qry2, qry3 ]
def stats(qry):
cursor = None
fetched = 1
count = 0
while fetched != 0:
fetched = qry.with_cursor(cursor).count()
count += fetched
cursor = qry.cursor()
return count - 1
user_count, application_user_count, application_count = [stats(q) for q in qries]
us = UserStatisticsTO()
us.user_count = user_count
us.service_user_count = application_user_count
us.service_count = application_count
return us
示例3: get_mobile_by_id
# 需要导入模块: from rogerthat.rpc.models import Mobile [as 别名]
# 或者: from rogerthat.rpc.models.Mobile import all [as 别名]
def get_mobile_by_id(mobile_id):
return Mobile.all().filter("id =", mobile_id).get()
示例4: get_active_mobiles_keys
# 需要导入模块: from rogerthat.rpc.models import Mobile [as 别名]
# 或者: from rogerthat.rpc.models.Mobile import all [as 别名]
def get_active_mobiles_keys():
return Mobile.all(keys_only=True).filter("status =", Mobile.STATUS_NEW | Mobile.STATUS_ACCOUNT_CREATED | Mobile.STATUS_REGISTERED)
示例5: get_user_active_mobiles_count
# 需要导入模块: from rogerthat.rpc.models import Mobile [as 别名]
# 或者: from rogerthat.rpc.models.Mobile import all [as 别名]
def get_user_active_mobiles_count(user):
return Mobile.all().filter("user =", user).filter("status =", Mobile.STATUS_NEW | Mobile.STATUS_ACCOUNT_CREATED | Mobile.STATUS_REGISTERED).count()
示例6: get_user_mobiles
# 需要导入模块: from rogerthat.rpc.models import Mobile [as 别名]
# 或者: from rogerthat.rpc.models.Mobile import all [as 别名]
def get_user_mobiles(user):
return Mobile.all().filter("user =", user)
示例7: get_mobiles_by_ios_push_id
# 需要导入模块: from rogerthat.rpc.models import Mobile [as 别名]
# 或者: from rogerthat.rpc.models.Mobile import all [as 别名]
def get_mobiles_by_ios_push_id(token):
return Mobile.all().filter("iOSPushId =", token.upper())