http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9923
Revision: 9923
Author: binbot
Date: 2012-02-22 18:12:11 +0000 (Wed, 22 Feb 2012)
Log Message:
-----------
Follow-up to r9922: the exceptions function given with 'include' key will take the
name of the fix as argument.
Modified Paths:
--------------
trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/replace.py
===================================================================
--- trunk/pywikipedia/replace.py 2012-02-22 17:26:32 UTC (rev 9922)
+++ trunk/pywikipedia/replace.py 2012-02-22 18:12:11 UTC (rev 9923)
@@ -317,12 +317,13 @@
prevent the bot of doing anything.
include
One standalone value, either the name of a dictionary in your
- file or the name of a callable function that returns such a
- dictionary. This dictionary may have any of the five above keys
- (but not 'include' itself!), and the lists belonging to those
- keys will be added to your exceptions. This way you may define
- one or more basic collection of exceptions used for multiple
- fixes, and add separate exceptions to each fix.
+ file or the name of a callable function that takes the name of
+ the fix as argument and returns a dictionary of exceptions.
+ This dictionary may have any of the five above keys (but not
+ 'include' itself!), and the lists belonging to those keys will
+ be added to your exceptions. This way you may define one or
+ more basic collection of exceptions used for multiple fixes,
+ and add separate exceptions to each fix.
"""
self.generator = generator
@@ -811,6 +812,7 @@
else:
# Perform one of the predefined actions.
+ fixname = fix # Save the name for passing to exceptions function.
try:
fix = fixes.fixes[fix]
except KeyError:
@@ -833,7 +835,7 @@
if 'include' in exceptions:
incl = exceptions['include']
if callable(incl):
- baseExcDict = incl()
+ baseExcDict = incl(fixname)
else:
try:
baseExcDict = incl