def spammer_reset(user_id): from model.po import Po, po_rm, reply_rm_if_can from zsite_tag import zsite_tag_rm_by_po for i in Po.where(user_id=user_id): po_rm(user_id, i.id) zsite_tag_rm_by_po(i) from model.reply import Reply for i in Reply.where(user_id=user_id): reply_rm_if_can(user_id, i.id) from model.wall import Wall from model.zsite import Zsite z = Zsite.mc_get(user_id) total = z.reply_count if total: reply_list = z.reply_list_reversed(total, 0) for reply in reply_list: wall = Wall.mc_get(reply.rid) if wall: wall.reply_rm(reply) spammer_new(user_id)
def get(self): id = int(self.get_argument('id')) user = self.current_user user_id = self.current_user_id m = po_rm(user_id, id) self.finish({ 'status':m })
def post(self, po_id): add = self.get_argument('add_spammer', None) del_all = self.get_argument('del_all', None) p = Po.mc_get(po_id) if p: user = p.user if user: user_id = user.id if add: spammer_new(user_id) if del_all: spammer_reset(user_id) po_rm(user_id, po_id) self.redirect('/po')
def post(self, po_id): add = self.get_argument("add_spammer", None) del_all = self.get_argument("del_all", None) p = Po.mc_get(po_id) if p: user = p.user if user: user_id = user.id if add: spammer_new(user_id) if del_all: spammer_reset(user_id) po_rm(user_id, po_id) self.redirect("/po")
def get(self, id): user = self.current_user user_id = self.current_user_id po_rm(user_id, id) self.redirect('%s/feed'%user.link)
def rm_rec_po_by_po_id(user_id,id): ''' DANGEROUS USE WITH CAUTION ''' for po in Po.where('cid = %s and rid=%s',CID_REC,id): po_rm(po.user_id,po.id)
def get(self): id = int(self.get_argument('id')) user = self.current_user user_id = self.current_user_id m = po_rm(user_id, id) self.finish({'status': m})