def index(page=1): postlist=Post.cached_get(False,User.PER_PAGE_IN_HOME,page); pagecount=Post.PostCount/User.PER_PAGE_IN_HOME+1 if Post.PostCount%User.PER_PAGE_IN_HOME==0: pagecount=pagecount-1 currentpage=page if postlist or page==1: return render_template("index.html", postlist=postlist, currentpage=currentpage, pagecount=pagecount) else : return render_template("error/index_not_found.html")