def remove(self, id): ''' 删除回复 ''' r = self.get(id) if r[0] and r[1] and (r[1]['channel'] == u'reply'): a = Added_id(r[1]['tid']) a.decr() return super(ReplyAPI, self).remove(id)
def save(self, content, owner=None, tid=None, channel=u'reply', **kwargs): ''' 保存回复 ''' if tid: a = Added_id(tid) a.incr() at_list = self._flt_at(content) self._fire_alert(channel, tid, at_list) return super(ReplyAPI, self).create(owner=owner, content=content, at_list=at_list, topic=tid, channel=channel, **kwargs)
def _count(self, tid): if not tid:return 0 a = Added_id(tid) c = a.count() return c if (c>0) else 0