def GET(self): cats = get_categories() pub_method = site_catindex() for cat in cats: html = pub_method.GET(cat.slug) path = os.path.join(cfg.publish_dir, cat.slug) if not os.path.exists(path): os.makedirs(os.path.abspath(path)) path = os.path.join(path, 'index.html') writefile(path, html) raise web.seeother('/index')
def GET(self): cats = get_categories() pub_method_obj = site_entlist() for cat in cats: recnum = info_count_query2(cat.id).count() psize = web.config.default_page_size pnum = recnum / psize + (recnum % psize > 0 and 1 or 0) path = os.path.join(cfg.publish_dir, cat.slug) if not os.path.exists(path): os.makedirs(os.path.abspath(path)) for i in range(1, pnum+1): html = pub_method_obj.GET(cat.slug, i) file_path = os.path.join(path, 'list_%d.html' % i) writefile(file_path, html) raise web.seeother('/index')