#! /usr/bin/env python
-"""Quick-quick implementation of WikiWikiWeb in Python
-"""
#
-# Copyright (C) 1999, 2000 Martin Pool <mbp@humbug.org.au>
-# This version includes additional changes by Gerardo Poggiali (2002)
-# This version includes additional changes by Bernardo Innocenti (2007)
+# Copyright 1999, 2000 Martin Pool <mbp@humbug.org.au>
+# Copyright 2002 Gerardo Poggiali
+# Copyright 2007 Bernardo Innocenti
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-__version__ = '$Revision: 1.63+gerry+bernie $'[11:-2]
+__version__ = '$Id$'[4:12]
+
+from time import clock
+start_time = clock()
-import cgi, sys, string, os, re, errno, time, stat
+import cgi, sys, string, os, re, errno, stat
from os import path, environ
# Regular expression defining a WikiWord
print_search_stats(len(hits), len(all_pages))
-
def do_titlesearch(needle):
# TODO: check needle is legal -- but probably we can just accept any RE
send_title(None, "Title search for \"" + needle + '"')
print_search_stats(len(hits), len(all_pages))
-
def print_search_stats(hits, searched):
print "<p>%d hits out of %d pages searched.</p>" % (hits, searched)
s = s + '</center></p>'
return s
-
def page_list():
return filter(word_re.match, os.listdir(text_dir))
-
def send_footer(name, mod_string=None):
if debug_cgi:
cgi.print_arguments()
cgi.print_form(cgi.FieldStorage())
cgi.print_environ()
+ global __version__
print '<div id="footer"><hr />'
- print '<p class="copyright">Powered by <a href="http://www.codewiz.org/wiki/GeekiGeeki">GeekiGeeki</a></p>'
+ print ('<p class="copyright"><span class="benchmark">generated in %0.3fs</span>' +
+ ' by <a href="http://www.codewiz.org/wiki/GeekiGeeki">GeekiGeeki</a>' +
+ ' version %s</p>') % (clock() - start_time, __version__)
if mod_string:
print '<p class="modified">last modified %s</p>' % mod_string
print '</div></body></html>'
-
# ----------------------------------------------------------
# Macros
def _macro_TitleSearch(*vargs):
if self.exists():
return link_tag(word, word, 'wikilink')
else:
- if nonexist_qm:
- return link_tag(word, '?', 'nonexistent') + word
- else:
- return link_tag(word, word, 'nonexistent')
+ return link_tag(word, nonexist_pfx + word, 'nonexistent')
def get_raw_body(self):
try:
datetime_fmt = '%a %d %b %Y %I:%M %p'
allow_edit = True # Is it possible to edit pages?
show_hosts = True # show hostnames?
- nonexist_qm = False # show '?' for nonexistent?
+ nonexist_pfx = '' # prefix before nonexistent link (usually '?')
debug_cgi = False # Set to True for CGI var dump
form = cgi.FieldStorage()