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


Python DatabaseManager.getUserThatOffered方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import getUserThatOffered [as 別名]

#.........這裏部分代碼省略.........
        '''

        if self.db.isThreadCompleted(comment.submission.id):
            if not self.debug:
                comment.reply('The thread is already completed and result recorded.')
                self.db.addCommentToReplied(comment.id)
                return
            else:
                print('The thread is already completed and result recorded.')
                return

        if str(comment.author) != str(comment.submission.author):
            comment.reply('Only the OP of the post determine it\'s status.')
            self.db.addCommentToReplied(comment.id)
            return

        self._completeDeal(comment, 'scam')
        self._reportUser(comment)
        # open the thread for offers again
        self.db.openThread(comment.submission.id)


    def _cancelDeal(self, comment):

        if self.db.isThreadCompleted(comment.submission.id):
            if not self.debug:
                comment.reply('The thread is already completed and result recorded.')
                self.db.addCommentToReplied(comment.id)
                return
            else:
                print('The thread is already completed and result recorded.')
                return

        offerer = self.db.getUserThatOffered(comment.submission.id)
        if not offerer:
            if not self.debug:
                comment.reply('No deal has been accepted to cancel.')
                self.db.addCommentToReplied(comment.id)
                return
            else:
                print('No deal has been accepted to cancel.')
                return
        else:
            if str(comment.author) != offerer[0] and str(comment.author) != str(comment.submission.author):
                if not self.debug:
                    comment.reply('Only the OP of the post or the accepted offerer can cancel the deal.')
                    self.db.addCommentToReplied(comment.id)
                    return
                else:
                    print('Only the OP of the post or the accepted offerer can cancel the deal.')
                    return
            else:
                self._completeDeal(comment, 'cancel')
                # open the thread for offers again
                self.db.openThread(comment.submission.id)


    def _completeDeal(self, comment, result):

        '''
            completes the deal on the thread based on the result
            pre:  praw comment object, and result of the thread
            post: the user is updated with the results and a confirmation
                  is replied 
        '''
開發者ID:NickHurst,項目名稱:ReputationManager,代碼行數:69,代碼來源:ReputationManager.py


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