@@ -0,0 +1,2634 @@
+#!/usr/bin/env python%0A%0Aclass pages(object):%0A    def __init__(self):%0A        self.previous = ''%0A        self.next = ''%0A        page_size = 10%0A    def pageinit(self,current_page,total_count,url,page_size,search):%0A        self.page_size = int(page_size)%0A        self.url = url%0A        self.current_page = int(current_page)%0A        self.total_count = total_count%0A        self._pagecount()%0A        if self.page_count %3C (self.current_page + 1): # or (self.page_count == self.current_page):%0A            self.next = 'null'%0A        if self.current_page == 1 :%0A            self.previous = 'null'%0A%0A        if self.page_count == 1:%0A            self.next = 'null'%0A            self.previous = 'null'%0A        %0A        if self.next != 'null':%0A            self.next = '%7Burl%7D?page=%7Bpage%7D&page_size=%7Bpage_size%7D&search=%7Bsearch%7D'.format(url=url,%0A                                                                                         page=self.current_page + 1,%0A                                                                                         page_size=self.page_size ,%0A                                                                                         search=search)%0A%0A        if self.previous != 'null':%0A            self.previous = '%7Burl%7D?page=%7Bpage%7D&page_size=%7Bpage_size%7D&search=%7Bsearch%7D'.format(url=url,%0A                                                                                         page=self.current_page - 1,%0A                                                                                         page_size=self.page_size ,%0A                                                                                         search=search)%0A%0A        return %7B%0A            'current_page': self.current_page,%0A            'next': self.next,%0A            'page_count': self.page_count,%0A            'page_size': self.page_size,%0A            'previous': self.previous,%0A            'results': '',%0A            'total_count': self.total_count,%0A        %7D%0A%0A    def _pagecount(self):%0A        page_count = self.total_count // self.page_size%0A        page_remainder = self.total_count %25 self.page_size%0A        if page_remainder != 0:%0A            page_count += 1%0A        self.page_count = page_count%0A%0A        if self.current_page %3E page_count:%0A            self.current_page = page_count%0A%0A    def ssp(self):%0A        return (self.current_page * self.page_size - self.page_size),(self.current_page * self.page_size)%0A%0Aif __name__ == '__main__':%0A    current_page = 2%0A    total_count = 1000%0A    url = 'http://127.0.0.1/vip/bb/'%0A    page_size = 10%0A    search ='all'%0A    pp=pages()%0A    bp = pp.pageinit(current_page,total_count,url,page_size,search)%0A    print(bp)%0A

Create page.py