本文整理匯總了Python中DatabaseManager.DatabaseManager.isThreadCompleted方法的典型用法代碼示例。如果您正苦於以下問題:Python DatabaseManager.isThreadCompleted方法的具體用法?Python DatabaseManager.isThreadCompleted怎麽用?Python DatabaseManager.isThreadCompleted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DatabaseManager.DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager.isThreadCompleted方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import isThreadCompleted [as 別名]
#.........這裏部分代碼省略.........
self.db.addCommentToReplied(comment.id)
return
else:
print('Only the OP of the post can accept.')
return
# if the parent exists parse it to get the offer
if parent:
offer = self._parseComment(parent, '!offer')
parent_author = str(parent.author)
# if for some reason there is no parent, reply with an error
else:
self._replyWithError(comment, 'NoParent')
return
# create the thread entry for later closing
self.db.createThreadEntry(comment.submission.id, parent_author, author, offer)
if not self.debug:
comment.reply(templates.ACCEPTED.format(author, parent_author, offer))
self.db.addCommentToReplied(comment.id)
else:
print(templates.ACCEPTED.format(author, parent_author, offer))
def _successOnDeal(self, comment):
'''
calls _completeDeal to complete a deal with 'success'
pre: praw comment object
post: None
'''
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):
if not self.debug:
comment.reply('Only the OP of the post determine it\'s status.')
self.db.addCommentToReplied(comment.id)
return
else:
print('Only the OP of the post determine it\'s status.')
return
self._completeDeal(comment, 'success')
def _scamOnDeal(self, comment):
'''
calls _completeDeal with 'scam' and reporsts user
pre: praw comment object
post: None
'''
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)