Exemple #1
0
 def _get_pagination_helper(self, request):
     if self._allow_pagination and self._native_pagination:
         return api_common.PaginationNativeHelper(request,
                                                  self._primary_key)
     elif self._allow_pagination:
         return api_common.PaginationEmulatedHelper(request,
                                                    self._primary_key)
     return api_common.NoPaginationHelper(request, self._primary_key)
def _get_pagination_helper(request, controller):
    if 'pagination_helper' in request.context:
        return request.context['pagination_helper']
    if not controller.allow_pagination:
        helper = api_common.NoPaginationHelper(request, controller.primary_key)
    elif controller.native_pagination:
        helper = api_common.PaginationNativeHelper(request,
                                                   controller.primary_key)
    else:
        helper = api_common.PaginationEmulatedHelper(request,
                                                     controller.primary_key)
    request.context['pagination_helper'] = helper
    return helper