本文整理匯總了Python中models.card.Card.incr_comment方法的典型用法代碼示例。如果您正苦於以下問題:Python Card.incr_comment方法的具體用法?Python Card.incr_comment怎麽用?Python Card.incr_comment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.card.Card
的用法示例。
在下文中一共展示了Card.incr_comment方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: incr_decr_get_comment
# 需要導入模塊: from models.card import Card [as 別名]
# 或者: from models.card.Card import incr_comment [as 別名]
def incr_decr_get_comment(self):
uid0 = User.add("test1", "password", "[email protected]")
bid0 = Board.add("board1", "A")
lid0 = List.add("To Do", bid0)
card_id = Card.add("card0", lid0, uid0)
card = Card.get(card_id)
Card.incr_comment(card_id)
assert 1 == card.get_comment_count()
Card.desc_comment(card_id)
assert 0 == card.get_comment_count()
示例2: add
# 需要導入模塊: from models.card import Card [as 別名]
# 或者: from models.card.Card import incr_comment [as 別名]
def add(cls, card_id, user_id, content):
comment = cls(card_id = card_id, user_id = user_id, content = content)
from models.card import Card
Card.incr_comment(card_id)
try:
mysql_session.add(comment)
mysql_session.commit()
except Exception as e:
mysql_session.rollback()
print "error in mysql commit:", e
raise
finally:
mysql_session.close()
return comment.id