http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9411
Revision: 9411
Author: xqt
Date: 2011-07-17 10:19:06 +0000 (Sun, 17 Jul 2011)
Log Message:
-----------
(user_)fixes.py stores recursive flag, patch bug #3368258 submitted by Bin?\195?\161ris.
Thanks!
Modified Paths:
--------------
trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/replace.py
===================================================================
--- trunk/pywikipedia/replace.py 2011-07-17 09:54:30 UTC (rev 9410)
+++ trunk/pywikipedia/replace.py 2011-07-17 10:19:06 UTC (rev 9411)
@@ -80,8 +80,8 @@
-fix:XYZ Perform one of the predefined replacements tasks, which are
given in the dictionary 'fixes' defined inside the file
fixes.py.
- The -regex and -nocase argument and given replacements will
- be ignored if you use -fix.
+ The -regex, -recursive and -nocase argument and given
+ replacements and exceptions will be ignored if you use -fix.
Currently available predefined fixes are:
&fixes-help;
@@ -717,9 +717,15 @@
fix['msg'])
if "exceptions" in fix:
exceptions = fix['exceptions']
+ if "recursive" in fix:
+ recursive = fix['recursive']
if "nocase" in fix:
caseInsensitive = fix['nocase']
- replacements = fix['replacements']
+ try:
+ replacements = fix['replacements']
+ except KeyError:
+ pywikibot.output(u"No replacements given in fix, don't joke with
me!")
+ return
#Set the regular expression flags
flags = re.UNICODE