pywikipedia r9923 - Code Review

Jump to: navigation, search
Repository:pywikipedia
Revision:r9922‎ | r9923 (on ViewVC)‎ | r9924 >
Date:18:12, 22 February 2012
Author:binbot
Status:new
Tags:
Comment:
Follow-up to r9922: the exceptions function given with 'include' key will take the name of the fix as argument.
Modified paths:

Diff [purge]

Index: trunk/pywikipedia/replace.py
@@ -317,12 +317,13 @@
318318 prevent the bot of doing anything.
319319 include
320320 One standalone value, either the name of a dictionary in your
321 - file or the name of a callable function that returns such a
322 - dictionary. This dictionary may have any of the five above keys
323 - (but not 'include' itself!), and the lists belonging to those
324 - keys will be added to your exceptions. This way you may define
325 - one or more basic collection of exceptions used for multiple
326 - fixes, and add separate exceptions to each fix.
 321+ file or the name of a callable function that takes the name of
 322+ the fix as argument and returns a dictionary of exceptions.
 323+ This dictionary may have any of the five above keys (but not
 324+ 'include' itself!), and the lists belonging to those keys will
 325+ be added to your exceptions. This way you may define one or
 326+ more basic collection of exceptions used for multiple fixes,
 327+ and add separate exceptions to each fix.
327328
328329 """
329330 self.generator = generator
@@ -811,6 +812,7 @@
812813
813814 else:
814815 # Perform one of the predefined actions.
 816+ fixname = fix # Save the name for passing to exceptions function.
815817 try:
816818 fix = fixes.fixes[fix]
817819 except KeyError:
@@ -833,7 +835,7 @@
834836 if 'include' in exceptions:
835837 incl = exceptions['include']
836838 if callable(incl):
837 - baseExcDict = incl()
 839+ baseExcDict = incl(fixname)
838840 else:
839841 try:
840842 baseExcDict = incl

Past revisions this follows-up on

Rev.Commit summaryAuthorDate
r9922Enable use of one or more basic exceptions dictionary for multiple fixes....binbot17:26, 22 February 2012
Personal tools
Namespaces

Variants
Views
Actions
Navigation
Support
Download
Development
Communication
Toolbox