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'))
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)
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')
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
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
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))
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))
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))
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)
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)
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)
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)
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')
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'))
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')
def testprint(self): print m_page('city')
def get(self): since = self.get_argument("since", None) cond = {} r, cates = m_page(T_CATEGORY, **cond) self.render("admin/category.html", data=cates)
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))
def get(self): since = self.get_argument("since", None) cond = {} r,cates = m_page(T_CATEGORY,**cond) self.render("admin/category.html", data = cates)
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))
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')
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))
def get(self): r, projects = m_page(TProject) self.render('action/project.html', projects=projects)
def get(self): r,cates = m_page(T_Servercity) self.write(dict(status = r,servercitys = cates))
def get(self): since = self.get_argument("since", None) cond = {} r,cates = m_page(T_Servercity,**cond) self.render("admin/servercity.html", data = cates)
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
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
def get(self): r, self.categorys = m_page(T_Category, size=10) self.render('action/projectsave.html')
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)
def get(self): r,projects = m_page(TProject) self.render('action/project.html',projects=projects)