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


Python DatabaseManager.addFinishedResults方法代碼示例

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


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

示例1: __init__

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

#.........這裏部分代碼省略.........
                                     a top level comment, so I don't know who succeed.
                                     try replying to the offer instead.''')
                    self.db.addCommentToReplied(comment.id)
                    return
                else:
                    print('''You didn\'t use the accept command and this is
                             a top level comment, so I don't know who succeed.
                             try replying to the offer instead.''')
                    return
            # then check if it's an offer
            elif '!offer' in str(parent):
                # then set the user as the parents author
                user = [str(parent.author)]
                # we'll also need to make a thread entry
                self.db.createThreadEntry(comment.submission.id, user, 
                                          str(comment.author), self._parseComment(comment, '!offer'))
            else:
                if not self.debug:
                    comment.reply('''An accept was never made, and I can't find
                                     the user that offered. Please try replying,
                                     to the offer or accept the offer and use success
                                     again''')
                    self.db.addCommentToReplied(comment.id)
                    return
                else:
                    print('''An accept was never made, and I can't find
                             the user that offered. Please try replying,
                             to the offer or accept the offer and use success
                             again''')
                    return


        # add the finished results
        self.db.addFinishedResults(user[0], result)
        self.db.completeThread(comment.submission.id)

        if not self.debug:
            comment.reply(templates.COMPLETED[result].format(user[0]))
            self.db.addCommentToReplied(comment.id)
        else:
            print(templates.COMPLETED[result].format(user[0]))


    def _replyWithError(self, comment, err):

        '''
            replies to comment with corresponding error message
            pre:  praw comment object, error type
            post: the comment is replied to with the error message
        '''

        if not self.debug:
            comment.reply(templates.ERROR[err])
            self.db.addCommentToReplied(comment.id)
        else:
            print(templates.ERROR[err])


    def _reportUser(self, comment):

        '''
            a message is sent to the mods with a user report
            pre:  praw comment object
            post: message is sent to moderators of the sub with a report 
        '''
開發者ID:NickHurst,項目名稱:ReputationManager,代碼行數:69,代碼來源:ReputationManager.py


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