Revision: 4083 Author: a_engels Date: 2007-08-21 23:44:54 +0000 (Tue, 21 Aug 2007)
Log Message: ----------- update - nl: now uses localized names for special pages
Modified Paths: -------------- trunk/pywikipedia/rcsort.py
Modified: trunk/pywikipedia/rcsort.py =================================================================== --- trunk/pywikipedia/rcsort.py 2007-08-21 22:27:47 UTC (rev 4082) +++ trunk/pywikipedia/rcsort.py 2007-08-21 23:44:54 UTC (rev 4083) @@ -1,11 +1,10 @@ -#!/usr/bin/python +#!/usr/bin/python # -*- coding: utf-8 -*- # A tool to see the recentchanges ordered by user instead of by date. This # is meant to be run as a CGI script. # Currently only works on Dutch Wikipedia, I do intend to make it more generally # usable. # Permission has been asked to run this on the toolserver. -__version__ = '$Id$'
import cgi import cgitb @@ -26,9 +25,8 @@ import wikipedia print "-->" mysite = wikipedia.getSite() -special = mysite.family.special_namespace(mysite.lang)
-post = 'title=%s:Recentchanges' % special +post = 'title=Speciaal:RecenteWijzigingen' for element in form: post += '&%s=%s'%(element,form[element].value) if not 'limit' in form: @@ -38,7 +36,7 @@ text = text.split('\n') rcoptions = False lines = [] -Ruser = re.compile('title="%s:Contributions/([^"]*)"' % special) +Ruser = re.compile('title="Speciaal:Bijdragen/([^"]*)"') Rnumber = re.compile('tabindex="(\d*)"') count = 0 for line in text: @@ -50,9 +48,8 @@ user = None count += 1 lines.append((user,count,line)) - print elif line.find('rcoptions') > -1: - print line.replace("/w/index.php?title=%s:Recentchanges&" % special,"rcsort.py?") + print line.replace("/w/index.php?title=Speciaal:RecenteWijzigingen&","rcsort.py?") rcoptions = True lines.sort() last = 0 @@ -63,10 +60,10 @@ if line[0] == None: print "<h2>Gebruiker onbekend</h2>" else: - wikipedia.output(u"<h2>%s</h2>"%line[0], toStdout=True) + wikipedia.output(u"<h2>%s</h2>"%line[0],showcgi=True) print "<ul>" last = line[0] - wikipedia.output(line[2].replace('href="/w','href="http://nl.wikipedia.org/w'), toStdout = True) + wikipedia.output(line[2].replace('href="/w','href="http://nl.wikipedia.org/w'), showcgi = True) print
print "</ul>"
pywikipedia-l@lists.wikimedia.org