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


Python TryLater.schedule方法代碼示例

本文整理匯總了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)
開發者ID:pombredanne,項目名稱:reddit,代碼行數:35,代碼來源:account.py

示例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()
開發者ID:13steinj,項目名稱:reddit-plugin-dfp,代碼行數:10,代碼來源:linkcontroller.py

示例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))
開發者ID:zeantsoi,項目名稱:reddit,代碼行數:22,代碼來源:account.py


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