Esempio n. 1
0
 def get(self, page_num=None):
     app = g.kv.get(settings.K_SITE_INFO)['app']
     if page_num is None:
         page_num = 1
     page_num = int(page_num)
     offset = (page_num - 1) * app
     self.render('index.html',
             iphone=ctrl.get_all_articles(offset=0, limit=100, need_abs=True, cid='3'),
             macbook=ctrl.get_all_articles(offset=0, limit=100, need_abs=True, cid='2'),
             ipad=ctrl.get_all_articles(offset=0, limit=100, need_abs=True, cid='5'),
             page_num=page_num, app=app)
Esempio n. 2
0
 def get(self, page_num=None):
     app = g.kv.get(settings.K_SITE_INFO)['app']
     total_num=(ctrl.get_articles_count() - 1) / app + 1
     if page_num is None:
         self.render('admin_manage_articles.html',
                 cur_num=1,
                 total_num=total_num,
                 articles=ctrl.get_all_articles(need_abs=True))
     else:
         self.write(self.macro('admin_widgets.html').manage_articles(
                 ctrl.get_all_articles(
                     (int(page_num) - 1) * app, need_abs=True),
                 page_num, total_num))
Esempio n. 3
0
 def get(self, page_num=None):
     app = g.kv.get(settings.K_SITE_INFO)['app']
     total_num = (ctrl.get_articles_count() - 1) / app + 1
     if page_num is None:
         self.render('admin_manage_articles.html',
                     cur_num=1,
                     total_num=total_num,
                     articles=ctrl.get_all_articles(need_abs=True))
     else:
         self.write(
             self.macro('admin_widgets.html').manage_articles(
                 ctrl.get_all_articles((int(page_num) - 1) * app,
                                       need_abs=True), page_num, total_num))
Esempio n. 4
0
 def get(self, page_num=None):
     app = g.kv.get(settings.K_SITE_INFO)['app']
     if page_num is None:
         page_num = 1
     page_num = int(page_num)
     offset = (page_num - 1) * app
     self.render('home.html',
             articles=ctrl.get_all_articles(offset=offset, limit=app),
             page_num=page_num, app=app)
Esempio n. 5
0
 def get(self, page_num=None):
     app = g.kv.get(settings.K_SITE_INFO)['app']
     if page_num is None:
         page_num = 1
     page_num = int(page_num)
     offset = (page_num - 1) * app
     self.render('home.html',
             articles=ctrl.get_all_articles(offset=offset, need_abs=True,limit=app),
             page_num=page_num, app=app)
Esempio n. 6
0
 def get(self):
     info = g.site_info()
     need_abs = not info['rss_full']
     rss = utils.rss_gen(
             title=info['title'],
             host=self.request.protocol + '://' + self.request.host,
             description=info['description'],
             articles=ctrl.get_all_articles(limit=50, need_abs=need_abs))
     self.set_header('Content-Type', 'text/xml')
     self.write(rss)
Esempio n. 7
0
 def get(self):
     info = g.site_info()
     need_abs = not info['rss_full']
     rss = utils.rss_gen(
             title=info['title'],
             host=self.request.protocol + '://' + self.request.host,
             description=info['description'],
             articles=ctrl.get_all_articles(limit=50, need_abs=need_abs))
     self.set_header('Content-Type', 'text/xml')
     self.write(rss)
Esempio n. 8
0
 def get(self, cid=None, page_num=None):
     if cid is None:
         # 归档首页
         self.render('archives.html', classes=ctrl.get_all_classes())
     else:
         app = g.kv.get(settings.K_SITE_INFO)['app']
         if page_num is None:
             page_num = 1
         page_num = int(page_num)
         offset = (page_num - 1) * app
         self.render('archives.html',
                 articles=ctrl.get_all_articles(
                     offset=offset, limit=app, need_abs=True, cid=cid),
                 page_num=page_num, app=app, cid=cid)
Esempio n. 9
0
 def get(self, cid=None, page_num=None):
     if cid is None:
         # 归档首页
         self.render('archives.html', classes=ctrl.get_all_classes())
     else:
         app = g.kv.get(settings.K_SITE_INFO)['app']
         if page_num is None:
             page_num = 1
         page_num = int(page_num)
         offset = (page_num - 1) * app
         self.render('archives.html',
                 articles=ctrl.get_all_articles(
                     offset=offset, limit=app, need_abs=True, cid=cid),
                 page_num=page_num, app=app, cid=cid)