Exemplo n.º 1
0
def _get_sorting_helper(request, controller):
    if 'sorting_helper' in request.context:
        return request.context['sorting_helper']
    if not controller.allow_sorting:
        helper = api_common.NoSortingHelper(request, controller.resource_info)
    elif controller.native_sorting:
        helper = api_common.SortingNativeHelper(request,
                                                controller.resource_info)
    else:
        helper = api_common.SortingEmulatedHelper(request,
                                                  controller.resource_info)
    request.context['sorting_helper'] = helper
    return helper
Exemplo n.º 2
0
 def _get_sorting_helper(self, request):
     if self._allow_sorting and self._native_sorting:
         return api_common.SortingNativeHelper(request, self._attr_info)
     elif self._allow_sorting:
         return api_common.SortingEmulatedHelper(request, self._attr_info)
     return api_common.NoSortingHelper(request, self._attr_info)