1 def get_page(self, suffix):
 
   3     A function which will be monkeypatched onto the request to get the current
 
   4     integer representing the current page.
 
   7         return int(self.REQUEST['page%s' % suffix])
 
   8     except (KeyError, ValueError, TypeError):
 
  11 class PaginationMiddleware(object):
 
  13     Inserts a variable representing the current page onto the request object if
 
  14     it exists in either **GET** or **POST** portions of the request.
 
  16     def process_request(self, request):
 
  17         request.__class__.page = get_page