view MoinMoin/macro/ @ 2999:e94b940f3a84

add a comment about listen backlog to moin.fcg (port from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 06 Jan 2008 17:32:33 +0100
parents b4118a77105d
children 2a3a6cb34e45
line wrap: on
line source
# -*- 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)