Make it possible not to generate empty lists
authorSverre Rabbelier <srabbelier@gmail.com>
Sun, 22 Feb 2009 11:18:19 +0000
changeset 1459 2584724403ff
parent 1458 ec06d3ee73e4
child 1460 8f3acefaa4e3
Make it possible not to generate empty lists Patch by: Sverre Rabbelier
app/soc/views/helper/lists.py
--- a/app/soc/views/helper/lists.py	Sun Feb 22 11:17:46 2009 +0000
+++ b/app/soc/views/helper/lists.py	Sun Feb 22 11:18:19 2009 +0000
@@ -100,7 +100,7 @@
   return request.path + link_suffix
 
 
-def getListContent(request, params, filter=None, idx=0):
+def getListContent(request, params, filter=None, idx=0, need_content=False):
   """Returns a dict with fields used for rendering lists.
 
   Args:
@@ -138,6 +138,9 @@
   # Fetch one more to see if there should be a 'next' link
   data = logic.getForFields(filter=filter, limit=limit+1, offset=offset)
 
+  if need_content and not data:
+    return None
+
   more = len(data) > limit
 
   if more: