本文整理汇总了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