changeset 4747:aa598735a74a

Do not show links on deprecated pages when running WantedPages. Fixes pt. 2 of DeprecatedIsNotRespected.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Fri, 03 Jul 2009 11:50:04 +0100
parents 3f426468f743
children 4fea31361567
files MoinMoin/macro/WantedPages.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/WantedPages.py	Fri Jul 03 11:38:55 2009 +0100
+++ b/MoinMoin/macro/WantedPages.py	Fri Jul 03 11:50:04 2009 +0100
@@ -36,6 +36,7 @@
 
     # build a dict of wanted pages
     wanted = {}
+    deprecated_links = []
     for name, page in pages.items():
         # Skip system pages, because missing translations are not wanted pages,
         # unless you are a translator and clicked "Include system pages"
@@ -44,13 +45,22 @@
 
         # Add links to pages which do not exist in pages dict
         links = page.getPageLinks(request)
+        is_deprecated = page.parse_processing_instructions(
+                ).get('deprecated', False)
+        
         for link in links:
             if not link in pages and request.user.may.read(link):
+                if is_deprecated:
+                    deprecated_links.append(link)
                 if link in wanted:
                     wanted[link][name] = 1
                 else:
                     wanted[link] = {name: 1}
 
+    for link in deprecated_links:
+        if len(wanted[link]) == 1:
+            del wanted[link]
+
     # Check for the extreme case when there are no wanted pages
     if not wanted:
         return u"%s<p>%s</p>" % (controlbar, _("No wanted pages in this wiki."))