コード例 #1
0
    def post(self):
        """

        """
        username=get_current_user(self)
        if '000'==username:
            type=self.request.get('type','')
            value=self.request.get('value',0)
            list=[]
            if type=='username':
                list=Note.all().filter('author =',str(value))
            if type=='groupid':
                list=Note.all().filter('group =',int(value)).order('-isTop').order('-updateTime')
            if type=='noteid':
                list=Note.get_by_id([int(value)])
        else:
            type=self.request.get('type','')
            value=self.request.get('value',0)
            list=[]
            if type=='username':
                list=Note.all().filter('author =',str(value))
            if type=='groupid':
                list=Note.all().filter('group =',int(value)).order('-isTop').order('-updateTime')
            if not type and not value:
                groupids=[]
                for g in Group.all().filter('author =',username):
                    groupids.append(g.key().id())
                list=Note.all().filter('group in',groupids).filter('isDelete =',False).order('-updateTime')
        notelist=[]
        for note in list:
            note.groupobj=getGroup(note.group)
            notelist.append(note)
        self.render('templates/noteList.html',{'list':notelist,'isadmin':('000'==username and [True] or [False])[0]})
コード例 #2
0
 def post(self):
     tagmap={}
     for tag in Tag.all():
         tagmap[str(tag.key().id())]=tag.name
     username=get_current_user(self)
     if '000'==username:
         type=self.request.get('type','')
         value=self.request.get('value',0)
         list=[]
         if type=='username':
             list=Group.all().filter('author =',str(value))
         if type=='groupid':
             list=Group.get_by_id([int(value)])
     else:
         list=Group.all().filter('author =',username)
     listgroup=[]
     for group in list:
         group.tagname=tagmap.get(str(group.tag),'')
         listgroup.append(group)
     self.render('templates/groupList.html',{'list':listgroup,'tagmap':tagmap,'isadmin':('000'==username and [True] or [False])[0]})
コード例 #3
0
    def get(self):
        username=get_current_user(self)
        grouplist=[]
        noteid=self.request.get('Noteid',0)
        note={}
        imglist=[]
        if noteid:
            note=Note.get_by_id(int(noteid))
            if note:
                imgstrlist=re.findall('(?i)templink/([^/\s\?&]*)/',note.content)

                for img in imgstrlist:
                    img=int(img)
                    imglist.append(img)
                imglist=Img.get_by_id(imglist)
                news, number = re.subn('[\*TempLink/([^/]*/[^\]]*]','', note.content)
                note.content=news
        groupid=self.request.get('GroupId')
        if note:
            groupid=note.group
        group=None
        if groupid:
#            group=Group.get_by_id(int(groupid))
            group=getGroup(int(groupid))
        if not group:
            if '000'==username:
                self.redirect('/GroupListM')
                return
            else:
                for g in Group.all().filter('author =',username):
                    grouplist.append(g)

        msg=memcache.get(self.request.get('msgid',''))
        if not msg:
            msg=''
        self.render('templates/noteAdd.html',{'group':group,'grouplist':grouplist,'note':note,'imglist':imglist,'msg':msg})
コード例 #4
0
ファイル: interface.py プロジェクト: wangjian2254/moguim
 def get(self):
     self.render('templates/group.html',{'grouplist':Group.all(),'taglist':Tag.all()})