diff MoinMoin/wikiutil.py @ 1866:0194beaf511e

reduce reduce, filter and map usage
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 10 Mar 2007 19:20:19 +0100
parents b180f047d918
children 64507f46beb2
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Fri Mar 09 00:56:44 2007 +0100
+++ b/MoinMoin/wikiutil.py	Sat Mar 10 19:20:19 2007 +0100
@@ -707,7 +707,7 @@
     @return: only the category pages of pagelist
     """
     func = request.cfg.cache.page_category_regex.search
-    return filter(func, pagelist)
+    return [pn for pn in pagelist if func(pn)]
 
 
 def getLocalizedPage(request, pagename): # was: getSysPage
@@ -824,7 +824,7 @@
     @return: the absolute page name
     """
     if pagename.startswith(PARENT_PREFIX):
-        pagename = '/'.join(filter(None, context.split('/')[:-1] + [pagename[PARENT_PREFIX_LEN:]]))
+        pagename = '/'.join([x for x in context.split('/')[:-1] + [pagename[PARENT_PREFIX_LEN:]] if x])
     elif pagename.startswith(CHILD_PREFIX):
         pagename = context + '/' + pagename[CHILD_PREFIX_LEN:]
     return pagename