~ubuntu-branches/ubuntu/oneiric/moin/oneiric-security

« back to all changes in this revision

Viewing changes to MoinMoin/macro/WantedPages.py

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-03-30 12:55:34 UTC
  • mfrom: (0.1.17 sid)
  • Revision ID: james.westby@ubuntu.com-20100330125534-4c2ufc1rok24447l
Tags: 1.9.2-2ubuntu1
* Merge from Debian testing (LP: #521834). Based on work by Stefan Ebner.
  Remaining changes:
 - Remove python-xml from Suggests field, the package isn't anymore in
   sys.path.
 - Demote fckeditor from Recommends to Suggests; the code was previously
   embedded in moin, but it was also disabled, so there's no reason for us
   to pull this in by default currently. Note: This isn't necessary anymore
   but needs a MIR for fckeditor, so postpone dropping this change until
   lucid+1
* debian/rules:
  - Replace hardcoded python2.5 with python* and hardcore python2.6 for ln
* debian/control.in: drop versioned depends on cdbs

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
        return ''
22
22
 
23
23
    # Get allpages switch from the form
24
 
    allpages = int(request.form.get('allpages', [0])[0]) != 0
 
24
    allpages = int(request.values.get('allpages', 0)) != 0
25
25
 
26
26
    # Control bar - filter the list of pages
27
27
    # TODO: we should make this a widget and use on all page listing pages
36
36
 
37
37
    # build a dict of wanted pages
38
38
    wanted = {}
 
39
    deprecated_links = []
39
40
    for name, page in pages.items():
40
41
        # Skip system pages, because missing translations are not wanted pages,
41
42
        # unless you are a translator and clicked "Include system pages"
44
45
 
45
46
        # Add links to pages which do not exist in pages dict
46
47
        links = page.getPageLinks(request)
 
48
        is_deprecated = page.parse_processing_instructions(
 
49
                ).get('deprecated', False)
 
50
 
47
51
        for link in links:
48
52
            if not link in pages and request.user.may.read(link):
 
53
                if is_deprecated:
 
54
                    deprecated_links.append(link)
49
55
                if link in wanted:
50
56
                    wanted[link][name] = 1
51
57
                else:
52
58
                    wanted[link] = {name: 1}
53
59
 
 
60
    for link in deprecated_links:
 
61
        if len(wanted[link]) == 1:
 
62
            del wanted[link]
 
63
 
54
64
    # Check for the extreme case when there are no wanted pages
55
65
    if not wanted:
56
66
        return u"%s<p>%s</p>" % (controlbar, _("No wanted pages in this wiki."))