Skip to content

Commit

Permalink
Return empty list when no records are found in paginated search (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-ladd authored Feb 16, 2023
1 parent 0b86bcf commit 81356f8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions netsuitesdk/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from netsuitesdk.internal.client import NetSuiteClient
from netsuitesdk.internal.utils import PaginatedSearch
from typing import List
from typing import List, Generator

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -78,17 +78,17 @@ def _serialize_array(self, records) -> List[OrderedDict]:
return zeep.helpers.serialize_object(records)

@staticmethod
def _paginated_search_to_generator(paginated_search):
def _paginated_search_to_generator(paginated_search) -> List:
records = []

if paginated_search.num_records == 0:
return
return records

num_pages = paginated_search.total_pages
logger.debug('total pages = %d, records in page = %d', paginated_search.total_pages, paginated_search.num_records)
logger.debug(f'current page index {paginated_search.page_index}')
logger.debug('going to page %d', 0)

records = []

for p in range(1, num_pages + 1):
logger.debug('going to page %d', p)
paginated_search.goto_page(p)
Expand Down

0 comments on commit 81356f8

Please sign in to comment.