Exemple #1
0
    def get(self, listname=None):
        cond = {'category': listname}
        since = self.get_argument('since', None)
        r, cate = m_info(T_Category, listname, key='listname')

        r, news = m_page(TNews, since=since, **cond)
        for n in news:
            r, user = m_info(T_Account, n.get('author'))
            n['authorname'] = user.get('nickname', user.get('username'))

        self.labels = suggest(3)
        r, comments = m_page(T_Comment)
        for c in comments:
            r, n = m_info(TNews, c.get('news_id'))
            if r and n:
                c['title'] = n.get('title')

            r, user = m_info(T_Account, c.get('author'))
            if r and user:
                c['authorname'] = user.get('nickname', user.get('username'))

        self.comments = comments
        self.render('action/newslist.html',
                    news=news,
                    since=since,
                    title=cate.get('name'))
Exemple #2
0
 def get(self):
     since = self.get_argument("since", None)
     groupid = self.get_argument('groupid',None)
     cond = {}
     if groupid:
         cond = dict(groupid = groupid)
     
     r,groups = m_page(T_GROUP,size=100)
     r,cates = m_page(T_CATEGORY,**cond)
     self.render("admin/category.html", data = cates, groups = groups, groupid = groupid)
Exemple #3
0
    def get(self):
        self.oneday = hot(5,1)
        self.weeknews = hot(5,7)
        self.monthnews = hot(5,30)
        r,self.categorys = m_page(T_Category,size=10)        
        news = {}
        for cate in self.categorys:
            r,news[cate.get('listname')] = m_page(TNews,category=cate.get('listname'))

        self.news = news
        self.render('action/news.html')
Exemple #4
0
    def test_upadte(self):
        r,parents =  m_page('city',size = 1000, parent=None)
        for i,item in enumerate(parents):
            m_update('city',item.get('_id'),id=i)
            r,rs = m_page('city',size=1000,parent=item.get('_id'))
            for n,city in enumerate(rs):
                m_update('city',city.get('_id'),id=int(str(i)+str(n)))
                r,items = m_page('city',size=1000,parent=city.get('_id'))
                for m,_city in enumerate(items):
                    m_update('city',_city.get('_id'),id=int(str(i)+str(n)+str(m)))


        print 'update end'
        parents =  m_page('city',level=0,parent=None)
        print parents
Exemple #5
0
    def test_upadte(self):
        r, parents = m_page('city', size=1000, parent=None)
        for i, item in enumerate(parents):
            m_update('city', item.get('_id'), id=i)
            r, rs = m_page('city', size=1000, parent=item.get('_id'))
            for n, city in enumerate(rs):
                m_update('city', city.get('_id'), id=int(str(i) + str(n)))
                r, items = m_page('city', size=1000, parent=city.get('_id'))
                for m, _city in enumerate(items):
                    m_update('city',
                             _city.get('_id'),
                             id=int(str(i) + str(n) + str(m)))

        print 'update end'
        parents = m_page('city', level=0, parent=None)
        print parents
Exemple #6
0
 def get(self, table):
     r, v = m_page(table,
                   since=self.get_argument('since', None),
                   addon=self.get_argument('addon', None))
     if r:
         self.write(dict(status=r, data=v, uid=self.uid))
     else:
         self.write(dict(status=r, data=v))
Exemple #7
0
    def get(self, news_id):
        since = self.get_argument("since", None)
        r, data = m_page(TComment, since=since, news_id=news_id)
        for item in data:
            r, v = m_info(T_Account, item["author"])
            if r and v:
                item["authorname"] = v.get("nickname", v["username"])

        self.write(dict(status=r, data=data))
Exemple #8
0
    def get(self, news_id):
        since = self.get_argument('since', None)
        r, data = m_page(TComment, since=since, news_id=news_id)
        for item in data:
            r, v = m_info(T_Account, item['author'])
            if r and v:
                item['authorname'] = v.get('nickname', v['username'])

        self.write(dict(status=r, data=data))
Exemple #9
0
    def get(self):
        since = self.get_argument('since',None)
        keys = self.get_arguments('key')
        cond = {'labels':{'$in':keys}}
        r,project = m_page(TProject,since=since,**cond)
        for n in project:
            r,user = m_info(T_Account,n.get('author'))
            n['authorname'] = user.get('nickname',user.get('username'))

        self.labels = suggest(3)
        self.render('action/projectlist.html',project=project,since=since, title=keys)
Exemple #10
0
    def get(self):
        since = self.get_argument('since', None)
        keys = self.get_arguments('key')
        cond = {'labels': {'$in': keys}}
        r, news = m_page(TNews, since=since, **cond)
        for n in news:
            r, user = m_info(T_Account, n.get('author'))
            n['authorname'] = user.get('nickname', user.get('username'))

        self.labels = suggest(3)
        r, comments = m_page(T_Comment)
        for c in comments:
            r, n = m_info(TNews, c.get('news_id'))
            if r and n:
                c['title'] = n.get('title')

            r, user = m_info(T_Account, c.get('author'))
            if r and user:
                c['authorname'] = user.get('nickname', user.get('username'))

        self.comments = comments
        self.render('action/newslist.html', news=news, since=since, title=keys)
Exemple #11
0
    def get(self):
        since = self.get_argument('since',None)
        keys = self.get_arguments('key')
        cond = {'labels':{'$in':keys}}
        r,news = m_page(TNews,since=since,**cond)
        for n in news:
            r,user = m_info(T_Account,n.get('author'))
            n['authorname'] = user.get('nickname',user.get('username'))

        self.labels = suggest(3)
        r,comments = m_page(T_Comment)
        for c in comments:
            r,n = m_info(TNews,c.get('news_id'))
            if r and n:
                c['title'] = n.get('title')
            
            r,user = m_info(T_Account,c.get('author'))
            if r and user:
                c['authorname'] = user.get('nickname',user.get('username'))

        self.comments = comments
        self.render('action/newslist.html',news=news,since=since, title=keys)
Exemple #12
0
    def get(self):
        since = self.get_argument('since', None)
        keys = self.get_arguments('key')
        cond = {'labels': {'$in': keys}}
        r, project = m_page(TProject, since=since, **cond)
        for n in project:
            r, user = m_info(T_Account, n.get('author'))
            n['authorname'] = user.get('nickname', user.get('username'))

        self.labels = suggest(3)
        self.render('action/projectlist.html',
                    project=project,
                    since=since,
                    title=keys)
Exemple #13
0
    def get(self):
        self.oneday = hot(5,1)
        self.weeknews = hot(5,7)
        self.monthnews = hot(5,30)
        r,self.categorys = m_page(T_Category,size=10)        
        news = {}
        for cate in self.categorys:
            r,news[cate.get('listname')] = m_page(TNews,category=cate.get('listname'))
        
        self.news = news
        self.labels = suggest(3)
        r,comments = m_page(T_Comment)
        for c in comments:
            r,n = m_info(TNews,c.get('news_id'))
            if r and n:
                c['title'] = n.get('title')

            r,user = m_info(T_Account,c.get('author'))
            if r and user:
                c['authorname'] = user.get('nickname',user.get('username'))
        
        self.comments = comments
        self.render('action/news.html')
Exemple #14
0
    def get(self,listname=None):
        cond = {'category':listname}
        since = self.get_argument('since',None)
        r,cate = m_info(T_Category,listname,key='listname')

        r,news = m_page(TNews,since=since,**cond)
        for n in news:
            r,user = m_info(T_Account,n.get('author'))
            n['authorname'] = user.get('nickname',user.get('username'))

        self.labels = suggest(3)
        r,comments = m_page(T_Comment)
        for c in comments:
            r,n = m_info(TNews,c.get('news_id'))
            if r and n:
                c['title'] = n.get('title')
            
            r,user = m_info(T_Account,c.get('author'))
            if r and user:
                c['authorname'] = user.get('nickname',user.get('username'))

        self.comments = comments
        self.render('action/newslist.html',news=news,since=since, title= cate.get('name'))
Exemple #15
0
    def get(self):
        self.oneday = hot(5, 1)
        self.weeknews = hot(5, 7)
        self.monthnews = hot(5, 30)
        r, self.categorys = m_page(T_Category, size=10)
        news = {}
        for cate in self.categorys:
            r, news[cate.get('listname')] = m_page(
                TNews, category=cate.get('listname'))

        self.news = news
        self.labels = suggest(3)
        r, comments = m_page(T_Comment)
        for c in comments:
            r, n = m_info(TNews, c.get('news_id'))
            if r and n:
                c['title'] = n.get('title')

            r, user = m_info(T_Account, c.get('author'))
            if r and user:
                c['authorname'] = user.get('nickname', user.get('username'))

        self.comments = comments
        self.render('action/news.html')
Exemple #16
0
 def testprint(self):
     print m_page('city')
Exemple #17
0
 def get(self):
     since = self.get_argument("since", None)
     cond = {}
     r, cates = m_page(T_CATEGORY, **cond)
     self.render("admin/category.html", data=cates)
Exemple #18
0
 def get(self):
     groupid = self.get_argument('groupid', None)
     cond = dict(groupid=groupid)
     r, cates = m_page(T_CATEGORY, **cond)
     self.write(dict(status=r, categorys=cates))
Exemple #19
0
 def get(self):
     since = self.get_argument("since", None)
     cond = {}
     r,cates = m_page(T_CATEGORY,**cond)
     self.render("admin/category.html", data = cates) 
Exemple #20
0
 def get(self):
     groupid = self.get_argument('groupid',None)
     cond = dict(groupid = groupid)
     r,cates = m_page(T_CATEGORY,**cond)
     self.write(dict(status = r,categorys = cates))
Exemple #21
0
 def get(self):
     self.labels = ['码农'.decode('utf-8'),'码码代']
     r,self.categorys = m_page(T_Category,size=10)        
     print self.categorys 
     self.render('action/newssave.html')
Exemple #22
0
 def get(self,table):
     r,v= m_page(table,since = self.get_argument('since',None),addon=self.get_argument('addon',None))
     if r:
         self.write(dict(status = r, data = v,uid = self.uid))
     else:
         self.write(dict(status = r, data =v))
Exemple #23
0
 def get(self):
     r, projects = m_page(TProject)
     self.render('action/project.html', projects=projects)
Exemple #24
0
 def get(self):
     r,cates = m_page(T_Servercity)
     self.write(dict(status = r,servercitys = cates))
Exemple #25
0
 def get(self):
     since = self.get_argument("since", None)
     cond = {}
     r,cates = m_page(T_Servercity,**cond)
     self.render("admin/servercity.html", data = cates) 
Exemple #26
0
 def get(self):
     r,self.categorys = m_page(T_Category,size=10)        
     self.render('action/newssave.html')
 def test_add(self):
     r,users = m_page('account',size=100)
     for item in users:
         #add(item['username'], item['password'], item['username'], group='bj', callback=self.on_end)
         pass
Exemple #28
0
 def get(self, news_id):
     since = self.get_argument('since',None)
     r,data = m_page(TComment,since=since, news_id=news_id)
     self.write(dict(status=r, data=data))
 def test_update(self):
     #update('*****@*****.**', name='badabab', callback=self.on_end)
     r,users = m_page('account',size=100)
     for item in users:
         update(item['username'],item['username'], group='bj', callback=self.on_end)
     pass
Exemple #30
0
 def get(self):
     r, self.categorys = m_page(T_Category, size=10)
     self.render('action/projectsave.html')
Exemple #31
0
 def get(self):
     since = self.get_argument("since", None)
     cond = {}
     r, cates = m_page(TNews, since=since, **cond)
     self.render("admin/news.html", data=cates)
Exemple #32
0
 def get(self):
     since = self.get_argument("since", None)
     cond = {}
     r, cates = m_page(TNews, since=since, **cond)
     self.render("admin/news.html", data=cates)
Exemple #33
0
 def get(self):
     r,projects = m_page(TProject)
     self.render('action/project.html',projects=projects)