changeset 1161:84ca2d77b8e4

Added support for "exclude_non_writable" in getAllPagesEx.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Wed, 09 Aug 2006 17:13:41 +0200
parents 3c80692b9b47
children 3e2b4beb65ed
files MoinMoin/xmlrpc/__init__.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/xmlrpc/__init__.py	Wed Aug 09 16:59:34 2006 +0200
+++ b/MoinMoin/xmlrpc/__init__.py	Wed Aug 09 17:13:41 2006 +0200
@@ -238,10 +238,12 @@
                 include_system:: set it to false if you do not want to see system pages
                 include_revno:: set it to True if you want to have lists with [pagename, revno]
                 include_deleted:: set it to True if you want to include deleted pages
+                exclude_non_writable:: do not include pages that the current user may not write to
         @rtype: list
         @return: a list of all pages.
         """
-        options = {"include_system": True, "include_revno": False, "include_deleted": False}
+        options = {"include_system": True, "include_revno": False, "include_deleted": False,
+                   "exclude_non_writable": False}
         if opts is not None:
             options.update(opts)
 
@@ -250,6 +252,9 @@
         else:
             filter = lambda name: True
 
+        if options["exclude_non_writable"]:
+            filter = lambda name, filter=filter: filter(name) and self.request.user.may.write(name)
+
         pagelist = self.request.rootpage.getPageList(filter=filter, exists=not options["include_deleted"])
         
         if options['include_revno']: