This file is indexed.

/usr/share/pyshared/MoinMoin/macro/RandomPage.py is in python-moinmoin 1.9.3-1ubuntu2.3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - RandomPage Macro

    @copyright: 2000 Juergen Hermann <jh@web.de>
    @license: GNU GPL, see COPYING for details.
"""

import random
random.seed()

from MoinMoin.Page import Page

Dependencies = ["time"]

def macro_RandomPage(macro, links=1):
    request = macro.request
    links = max(links, 1) # at least 1 link

    # Get full page unfiltered page list - very fast!
    all_pages = request.rootpage.getPageList(user='', exists=0)

    # Now select random page from the full list, and if it exists and we
    # can read it, save.
    pages = []
    found = 0
    while found < links and all_pages:
        # Take one random page from the list
        pagename = random.choice(all_pages)
        all_pages.remove(pagename)

        # Filter out deleted pages or pages the user may not read.
        page = Page(request, pagename)
        if page.exists() and request.user.may.read(pagename):
            pages.append(pagename)
            found += 1

    if not pages:
        return ''

    f = macro.formatter

    # return a single page link
    if links == 1:
        name = pages[0]
        return (f.pagelink(1, name, generated=1) +
                f.text(name) +
                f.pagelink(0, name))

    # return a list of page links
    pages.sort()
    result = []
    write = result.append

    write(f.bullet_list(1))
    for name in pages:
        write(f.listitem(1))
        write(f.pagelink(1, name, generated=1))
        write(f.text(name))
        write(f.pagelink(0, name))
        write(f.listitem(0))
    write(f.bullet_list(0))

    result = ''.join(result)
    return result