diff --git a/lbry/lbry/extras/daemon/Daemon.py b/lbry/lbry/extras/daemon/Daemon.py index aac767f80..e01e1410d 100644 --- a/lbry/lbry/extras/daemon/Daemon.py +++ b/lbry/lbry/extras/daemon/Daemon.py @@ -1774,7 +1774,7 @@ class Daemon(metaclass=JSONRPCServerType): [--claim_name=] [--blobs_in_stream=] [--blobs_remaining=] [--sort=] [--comparison=] [--full_status=] [--reverse] - [(--page= --page_size=)] + [--page= --page_size=] Options: --sd_hash= : (str) get file with matching sd hash @@ -1793,8 +1793,8 @@ class Daemon(metaclass=JSONRPCServerType): --blobs_remaining= : (int) amount of remaining blobs to download --sort= : (str) field to sort by (one of the above filter fields) --comparison= : (str) logical comparison, (eq | ne | g | ge | l | le) - --page= : (int) page to view within paginated output - --page_size= : (int) size of each page within paginated output + --page= : (int) page to return during paginating + --page_size= : (int) number of items on page during pagination Returns: {Paginated[Output]} """ @@ -1805,7 +1805,9 @@ class Daemon(metaclass=JSONRPCServerType): sort, reverse, comparison, **kwargs ) - if None not in (page, page_size): + if page is not None or page_size is not None: + page = page or 1 + page_size = page_size or 10 total_items = len(file_list) offset = page_size * (page-1) return { @@ -1818,7 +1820,6 @@ class Daemon(metaclass=JSONRPCServerType): return file_list - @requires(STREAM_MANAGER_COMPONENT) async def jsonrpc_file_set_status(self, status, **kwargs): """ diff --git a/lbry/tests/integration/test_file_commands.py b/lbry/tests/integration/test_file_commands.py index f88e86dd9..906a934f7 100644 --- a/lbry/tests/integration/test_file_commands.py +++ b/lbry/tests/integration/test_file_commands.py @@ -165,15 +165,15 @@ class FileCommands(CommandTestCase): file_list = self.daemon.jsonrpc_file_list() self.assertIsInstance(file_list, list) - # Should return a list + # Should paginate file_list = self.daemon.jsonrpc_file_list(page=1) - self.assertIsInstance(file_list, list) + self.assertIsInstance(file_list, dict) - # SHould return a list + # Also should paginate file_list = self.daemon.jsonrpc_file_list(page_size=212312) - self.assertIsInstance(file_list, list) + self.assertIsInstance(file_list, dict) - # Should return a paginated dict holding the list + # Definitely should paginate file_list = self.daemon.jsonrpc_file_list(page=1, page_size=50) self.assertIsInstance(file_list, dict)