本文整理匯總了Python中r2.models.trylater.TryLater.schedule方法的典型用法代碼示例。如果您正苦於以下問題:Python TryLater.schedule方法的具體用法?Python TryLater.schedule怎麽用?Python TryLater.schedule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類r2.models.trylater.TryLater
的用法示例。
在下文中一共展示了TryLater.schedule方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: delete
# 需要導入模塊: from r2.models.trylater import TryLater [as 別名]
# 或者: from r2.models.trylater.TryLater import schedule [as 別名]
def delete(self, delete_message=None):
self.delete_message = delete_message
self.delete_time = datetime.now(g.tz)
self._deleted = True
self._commit()
# update caches
Account._by_name(self.name, allow_deleted=True, _update=True)
# we need to catch an exception here since it will have been
# recently deleted
try:
Account._by_name(self.name, _update=True)
except NotFound:
pass
# remove from friends lists
q = Friend._query(Friend.c._thing2_id == self._id, Friend.c._name == "friend", eager_load=True)
for f in q:
f._thing1.remove_friend(f._thing2)
q = Friend._query(Friend.c._thing2_id == self._id, Friend.c._name == "enemy", eager_load=True)
for f in q:
f._thing1.remove_enemy(f._thing2)
# wipe out stored password data after a recovery period
TryLater.schedule("account_deletion", self._id36, delay=timedelta(days=90))
# Remove OAuth2Client developer permissions. This will delete any
# clients for which this account is the sole developer.
from r2.models.token import OAuth2Client
for client in OAuth2Client._by_developer(self):
client.remove_developer(self)
示例2: _check_edits
# 需要導入模塊: from r2.models.trylater import TryLater [as 別名]
# 或者: from r2.models.trylater.TryLater import schedule [as 別名]
def _check_edits(link):
checking_edits = getattr(link, "dfp_checking_edits", False)
if not checking_edits:
TryLater.schedule("dfp_check_edits", link._fullname, timedelta(minutes=5))
link.dfp_checking_edits = True
link._commit()
示例3: delete
# 需要導入模塊: from r2.models.trylater import TryLater [as 別名]
# 或者: from r2.models.trylater.TryLater import schedule [as 別名]
def delete(self, delete_message=None):
self.delete_message = delete_message
self.delete_time = datetime.now(g.tz)
self._deleted = True
self._commit()
# update caches
Account._by_name(self.name, allow_deleted=True, _update=True)
# we need to catch an exception here since it will have been
# recently deleted
try:
Account._by_name(self.name, _update=True)
except NotFound:
pass
# Mark this account for immediate cleanup tasks
amqp.add_item("account_deleted", self._fullname)
# schedule further cleanup after a possible recovery period
TryLater.schedule("account_deletion", self._id36, delay=timedelta(days=90))