本文整理匯總了Python中DatabaseManager.DatabaseManager.openThread方法的典型用法代碼示例。如果您正苦於以下問題:Python DatabaseManager.openThread方法的具體用法?Python DatabaseManager.openThread怎麽用?Python DatabaseManager.openThread使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DatabaseManager.DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager.openThread方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import openThread [as 別名]
#.........這裏部分代碼省略.........
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)
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: