def get(self): page = self.request.GET.get('page', "1") try: page = int(page) except: self.abort(400, 'page is invalid') page = max(1, page) count = History.count() start = (page - 1) * PAGE_SIZE historys = History.gets_all(start, PAGE_SIZE) self.render_response('/history.html', historys=historys, page = page, page_count = -(-count / PAGE_SIZE))