/usr/share/pyshared/MoinMoin/macro/PageCount.py is in python-moinmoin 1.9.3-1ubuntu2.
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 | # -*- coding: iso-8859-1 -*-
"""
Outputs the page count of the wiki.
@copyright: 2007 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details
"""
Dependencies = ['namespace']
from MoinMoin import wikiutil
def macro_PageCount(macro, exists=None):
""" Return number of pages readable by current user
Return either an exact count (slow!) or fast count including deleted pages.
TODO: make macro syntax more sane
"""
request = macro.request
exists = wikiutil.get_unicode(request, exists, 'exists')
# Check input
only_existing = False
if exists == u'exists':
only_existing = True
elif exists:
raise ValueError("Wrong argument: %r" % exists)
count = request.rootpage.getPageCount(exists=only_existing)
return macro.formatter.text("%d" % count)
|