示例#1
0
 def page_count(cls, entries_count):
     parser = TornadoConfigParser()
     page_size = int(parser.get('pagination', 'page_size'))
     if entries_count % page_size == 0:
         return entries_count / page_size
     else:
         return entries_count / page_size + 1
示例#2
0
 def page_count(cls, entries_count):
     parser = TornadoConfigParser()
     page_size = int(parser.get('pagination', 'page_size'))
     if entries_count % page_size == 0:
         return entries_count / page_size
     else:
         return entries_count / page_size + 1
示例#3
0
 def add_limit_clause(cls, sql, page):
     parser = TornadoConfigParser()
     page_size = parser.get('pagination', 'page_size')
     start_pos = (int(page) - 1) * int(page_size)  # 起始位置
     sql += " limit %s, %s" % (start_pos, page_size)
     return sql
示例#4
0
 def add_limit_clause(cls, sql, page):
     parser = TornadoConfigParser()
     page_size = parser.get('pagination', 'page_size')
     start_pos = (int(page) - 1) * int(page_size)  # 起始位置
     sql += " limit %s, %s" % (start_pos, page_size)
     return sql