diff --git a/lib/entropy/client/services/interfaces.py b/lib/entropy/client/services/interfaces.py index f1b47517a..8970af9f3 100644 --- a/lib/entropy/client/services/interfaces.py +++ b/lib/entropy/client/services/interfaces.py @@ -296,20 +296,20 @@ class DocumentList(list): elements list offset, and if there are more elements on the remote service. """ - def __init__(self, package_name, total, offset): + def __init__(self, package_name, has_more, offset): """ DocumentList constructor. @param package_name: package name string @type package_name: string - @param total: number of total documents available - @type total: int + @param has_more: True, if there are more documents available + @type has_more: bool @param offset: list offset used by remote service @type offset: int """ list.__init__(self) self._package_name = package_name - self._total = total + self._has_more = has_more self._offset = offset def package_name(self): @@ -321,15 +321,6 @@ class DocumentList(list): """ return self._package_name - def total(self): - """ - Return the total amount of remotely available documents. - - @return: the total amount of remotely available documents. - @rtype: int - """ - return self._total - def offset(self): """ Return the used offset for fetching this list. @@ -347,7 +338,7 @@ class DocumentList(list): given the current offset @rtype: int """ - return (self._total - self._offset - len(self)) + return self._has_more class DocumentFactory(object): @@ -1186,6 +1177,7 @@ class ClientWebService(WebService): "filter": " ".join([str(x) for x in document_type_filter]), "offset": offset, "latest": latest_str, + "revision": "1", } if service_cache: params["cache"] = "1" @@ -1195,13 +1187,15 @@ class ClientWebService(WebService): for package_name in package_names: objs_map = objs.get(package_name) if not objs_map: - data[package_name] = DocumentList(package_name, 0, offset) + data[package_name] = DocumentList( + package_name, False, offset) continue - total, docs = objs_map['total'], objs_map['docs'] + has_more, docs = objs_map.get('has_more', False), \ + objs_map['docs'] m_objs = data.setdefault(package_name, - DocumentList(package_name, total, offset)) + DocumentList(package_name, has_more, offset)) for obj in docs: d_obj = Document(self._repository_id, obj[Document.DOCUMENT_DOCUMENT_ID], diff --git a/lib/tests/standalone/webserv.py b/lib/tests/standalone/webserv.py index 4e05cff4a..02cd969dd 100644 --- a/lib/tests/standalone/webserv.py +++ b/lib/tests/standalone/webserv.py @@ -744,7 +744,6 @@ class EntropyWebServicesTest(unittest.TestCase): for vals in docs.values(): self.assertTrue(isinstance(vals, DocumentList)) self.assertEqual(vals.package_name(), pk) - self.assertTrue(isinstance(vals.total(), int)) self.assertTrue(isinstance(vals.has_more(), int)) self.assertEqual(vals.offset(), 0) for val in vals: diff --git a/rigo/rigo/models/application.py b/rigo/rigo/models/application.py index 3217b4884..d8da143ac 100644 --- a/rigo/rigo/models/application.py +++ b/rigo/rigo/models/application.py @@ -737,10 +737,9 @@ class ApplicationMetadata(object): fetched_images.append(image) # final DocumentList may contain less elements - # than those advertised by total(). _outcome = DocumentList( images.package_name(), - images.total(), + images.has_more(), images.offset()) _outcome.extend(fetched_images) outcome = _outcome diff --git a/rigo/rigo/ui/gtk3/controllers/application.py b/rigo/rigo/ui/gtk3/controllers/application.py index b76ce35ed..22c34461e 100644 --- a/rigo/rigo/ui/gtk3/controllers/application.py +++ b/rigo/rigo/ui/gtk3/controllers/application.py @@ -1037,8 +1037,9 @@ class ApplicationViewController(GObject.Object): const_debug_write( __name__, "MetadataDownloader._download_callback: " - "total: %s, offset: %s" % ( - document_list.total(), document_list.offset())) + "has_more: %s, offset: %s" % ( + document_list.has_more(), + document_list.offset())) self._callback(self, self._app, document_list, has_more)