def get(self):
     msgid=self.request.get('msg')
     msg=None
     if msgid:
         msg=memcache.get(msgid)
     newrsslist=getNewRssList()
     if newrsslist==None:
         newrsslist=NewRSSList(key_name='newrsslist')
         newrsslist.put()
         memcache.set('newrsslist',newrsslist,360000)
     groupids=newrsslist.groupids
     groupids.reverse()
     if groupids:
         grouplist=Group.get_by_id(groupids)
     else:
         grouplist=[]
     self.render('templates/newrss.html',{'list':grouplist,'msg':msg})
    def get(self):
        groupid=self.request.get('groupid')
        if groupid:
            groupid=int(groupid)
            newrsslist=getNewRssList()
            if not  newrsslist :
                msg=u'删除失败。'
            if newrsslist and groupid  in newrsslist.groupids:
                newrsslist.groupids.remove(groupid)
                newrsslist.put()
                memcache.set('newrsslist',newrsslist,360000)
                msg=u'删除成功。'
        else:
            msg=u'删除失败,没有群号'

        msgid=str(uuid.uuid4())
        memcache.set(msgid,msg,3600)
        self.redirect('/NewRSSListM?msg='+msgid)
    def post(self):
        groupid=self.request.get('groupid')
        if groupid:
            groupid=int(groupid)
            newrsslist=getNewRssList()

            if not  newrsslist or not Group.get_by_id(groupid) :
                msg=u'添加失败,群不存在。'
            elif newrsslist and groupid not in newrsslist.groupids:
                newrsslist.groupids.append(groupid)
                newrsslist.put()
                memcache.set('newrsslist',newrsslist,360000)
                msg=u'添加成功。'
            else:
                msg=u'添加失败,已经存在。'
        else:
            msg=u'添加失败,没有群号'

        msgid=str(uuid.uuid4())
        memcache.set(msgid,msg,3600)
        self.redirect('/NewRSSListM?msg='+msgid)