changeset 297:4115999d85e9

fixes behavior when maxItems is 0
author souliane <souliane@mailoo.org>
date Thu, 10 Sep 2015 15:03:12 +0200
parents 6ce33757d21e
children 648f294601c2
files sat_pubsub/gateway.py sat_pubsub/memory_storage.py sat_pubsub/pgsql_storage.py
diffstat 3 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sat_pubsub/gateway.py	Thu Sep 10 15:02:03 2015 +0200
+++ b/sat_pubsub/gateway.py	Thu Sep 10 15:03:12 2015 +0200
@@ -893,7 +893,7 @@
 
     def items(self, xmppURI, maxItems=None):
         query = {'uri': xmppURI}
-        if maxItems:
+        if maxItems is not None:
              query['max_items'] = int(maxItems)
         f = getPageWithFactory(self._makeURI('items', query),
                     method='GET',
--- a/sat_pubsub/memory_storage.py	Thu Sep 10 15:02:03 2015 +0200
+++ b/sat_pubsub/memory_storage.py	Thu Sep 10 15:03:12 2015 +0200
@@ -292,7 +292,7 @@
 
 
     def getItems(self, authorized_groups, unrestricted, maxItems=None):
-        if maxItems:
+        if maxItems is not None:
             itemList = self._itemlist[-maxItems:]
         else:
             itemList = self._itemlist
--- a/sat_pubsub/pgsql_storage.py	Thu Sep 10 15:02:03 2015 +0200
+++ b/sat_pubsub/pgsql_storage.py	Thu Sep 10 15:03:12 2015 +0200
@@ -747,7 +747,7 @@
 
         query.append("ORDER BY date %s" % order)
 
-        if maxItems:
+        if maxItems is not None:
             query.append("LIMIT %s")
             args.append(maxItems)