X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=geekigeeki.py;h=7193d5520b50af8bb709453f3cb53f721d9c7efd;hb=e3f54bfe72a742afbe81e363bacc1869959f50c9;hp=46c61c55ad5343f95bbf6541eb959a6cab0f0638;hpb=25befe4147c23d55b1ef3fc8af45c719e2e39f8c;p=geekigeeki.git
diff --git a/geekigeeki.py b/geekigeeki.py
index 46c61c5..7193d55 100755
--- a/geekigeeki.py
+++ b/geekigeeki.py
@@ -1,10 +1,9 @@
-#! /usr/bin/env python
-"""Quick-quick implementation of WikiWikiWeb in Python
-"""
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
#
-# Copyright (C) 1999, 2000 Martin Pool
-# This version includes additional changes by Gerardo Poggiali (2002)
-# This version includes additional changes by Bernardo Innocenti (2007)
+# Copyright 1999, 2000 Martin Pool
+# 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
@@ -19,9 +18,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-__version__ = '$Revision: 1.63+gerry+bernie $'[11:-2]
+__version__ = '$Id$'[4:12]
-import cgi, sys, string, os, re, errno, time, stat
+from time import clock
+start_time = clock()
+
+import cgi, sys, string, os, re, errno, stat
from os import path, environ
# Regular expression defining a WikiWord
@@ -102,16 +104,17 @@ def send_title(name, text="Limbo", msg=None, msg_type='error'):
# Head
emit_header()
- print """
-
-"""
+ print ''
+ print ''
+
+ site_name = globals().get('site_name', 'Unconfigured Site')
print "%s: %s" % (site_name, text)
print ' '
if not name:
print ' '
- if css_url:
- print ' ' % css_url
+ for css in css_url:
+ print ' ' % css
print ''
# Body
@@ -127,15 +130,17 @@ def send_title(name, text="Limbo", msg=None, msg_type='error'):
print '
'
print ' ' + site_name + ': ',
if name:
- print link_tag('?fullsearch=' + name, text) + ' '
+ print link_tag('?fullsearch=' + name, text, 'navlink') + ' '
else:
print text + ' '
print ' | ' + link_tag('FrontPage', 'Front Page', 'navlink')
print ' | ' + link_tag('FindPage', 'Find Page', 'navlink')
- print ' | Recent Changes'
+ if globals().has_key('history_url'):
+ print ' | Recent Changes'
+ if name:
+ print ' | Page History'
if name:
- print ' | Page History'
print ' | ' + link_tag('?raw=' + name, 'Raw Text', 'navlink')
if privileged_url is not None:
print ' | ' + link_tag('?edit=' + name, 'Edit Page', 'navlink', authentication=True)
@@ -154,8 +159,7 @@ def link_tag(params, text=None, ss_class=None, authentication=False):
classattr = ''
if ss_class:
classattr += 'class="%s" ' % ss_class
- # Prevent crawlers from following links to generated pages
- # and links added by potential spammers
+ # Prevent crawlers from following links potentially added by spammers or to generated pages
if ss_class == 'external' or ss_class == 'navlink':
classattr += 'rel="nofollow" '
if authentication:
@@ -187,13 +191,12 @@ def do_fullsearch(needle):
for (count, page_name) in hits:
print '
' % (letter, letter)
last_letter = letter
@@ -317,7 +317,7 @@ def _macro_TitleIndex(*vargs):
current_letter = None
for name in pages:
letter = string.lower(name[0])
- if letter <> current_letter:
+ if letter != current_letter:
s = s + '