changeset 1311:25b82e0741bb

Document the pages done in Page.getPageList, added return_objects kwarg.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Thu, 17 Aug 2006 19:10:30 +0200
parents 05602636efa7
children 73ea47cbfc79
files MoinMoin/Page.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Thu Aug 17 11:14:02 2006 +0200
+++ b/MoinMoin/Page.py	Thu Aug 17 19:10:30 2006 +0200
@@ -636,7 +636,8 @@
 
         return count
 
-    def getPageList(self, user=None, exists=1, filter=None, include_underlay=True):
+    def getPageList(self, user=None, exists=1, filter=None, include_underlay=True,
+                    return_objects=False):
         """ List user readable pages under current page
 
         Currently only request.rootpage is used to list pages, but if we
@@ -662,6 +663,9 @@
         @param user: the user requesting the pages (MoinMoin.user.User)
         @param filter: filter function
         @param exists: filter existing pages
+        @param include_underlay: determines if underlay pages are returned as well
+        @param return_objects: lets it return a list of Page objects instead of
+            names
         @rtype: list of unicode strings
         @return: user readable wiki page names
         """
@@ -684,7 +688,7 @@
 
                 cache[pagename] = None
 
-        if user or exists or filter:
+        if user or exists or filter or not include_underlay or return_objects:
             # Filter names
             pages = []
             for name in cache:
@@ -707,7 +711,10 @@
                 if user and not user.may.read(name):
                     continue
 
-                pages.append(name)
+                if return_objects:
+                    pages.append(page)
+                else:
+                    pages.append(name)
         else:
             pages = cache.keys()