http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9014
Revision: 9014
Author: xqt
Date: 2011-02-28 06:28:43 +0000 (Mon, 28 Feb 2011)
Log Message:
-----------
Do not remove links in -force option if bot triggers unicode bug #3081100; warn operator in non-autonomous mode deleting a page on hi- and cdo-wiki.
Modified Paths:
--------------
trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py
===================================================================
--- trunk/pywikipedia/interwiki.py 2011-02-28 00:45:39 UTC (rev 9013)
+++ trunk/pywikipedia/interwiki.py 2011-02-28 06:28:43 UTC (rev 9014)
@@ -1976,7 +1976,9 @@
# When running in autonomous mode without -force switch, make sure we
# don't remove any items, but allow addition of the new ones
- if globalvar.autonomous and not globalvar.force and len(removing) > 0:
+ if globalvar.autonomous and (not globalvar.force or
+ pywikibot.unicode_error
+ ) and len(removing) > 0:
for rmsite in removing:
# Sometimes sites have an erroneous link to itself as an
# interwiki
@@ -1984,7 +1986,8 @@
continue
rmPage = old[rmsite]
#put it to new means don't delete it
- if not globalvar.cleanup or \
+ if not globalvar.cleanup and not globalvar.force or \
+ globalvar.cleanup and \
rmPage.aslink(forceInterwiki=True) not in globalvar.remove or \
rmPage.site().lang in ['hi', 'cdo'] and \
pywikibot.unicode_error: #work-arround for bug #3081100 (do not remove hi-pages)
@@ -2037,6 +2040,12 @@
self.problem(u'Found incorrect link to %s in %s'
% (",".join([x.lang for x in removing]),
page.aslink(True)), createneed=False)
+ if pywikibot.unicode_error:
+ for x in removing:
+ if x.lang in ['hi', 'cdo']:
+ pywikibot.output(
+u'\03{lightred}WARNING: This may be false positive due to unicode bug #3081100\03{default}')
+ break
ask = True
if globalvar.force or globalvar.cleanup:
ask = False
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9013
Revision: 9013
Author: amir
Date: 2011-02-28 00:45:39 +0000 (Mon, 28 Feb 2011)
Log Message:
-----------
bugfix for #3172883
Modified Paths:
--------------
trunk/pywikipedia/djvutext.py
Modified: trunk/pywikipedia/djvutext.py
===================================================================
--- trunk/pywikipedia/djvutext.py 2011-02-27 13:02:29 UTC (rev 9012)
+++ trunk/pywikipedia/djvutext.py 2011-02-28 00:45:39 UTC (rev 9013)
@@ -48,7 +48,7 @@
# On English Wikisource, {{blank page}} is used to track blank pages.
# It may be omitted by adding an empty string like has been done for 'fr'.
blank = {
- 'en': u'{{blank page}}',
+ 'en': u"<pagequality level=\"0\" user="+config.usernames['wikisource']['en']+u" />",
'fa': u'',
'fr': u'',
'pt': u'',
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9010
Revision: 9010
Author: xqt
Date: 2011-02-25 15:10:25 +0000 (Fri, 25 Feb 2011)
Log Message:
-----------
Dont test against page.canBeEdited() if we only save to file and do not edit live wiki (patch submitted by Bin?\195?\161ris)
Modified Paths:
--------------
trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/replace.py
===================================================================
--- trunk/pywikipedia/replace.py 2011-02-25 10:06:42 UTC (rev 9009)
+++ trunk/pywikipedia/replace.py 2011-02-25 15:10:25 UTC (rev 9010)
@@ -441,7 +441,7 @@
try:
# Load the page's text from the wiki
original_text = page.get(get_redirect=True)
- if not page.canBeEdited():
+ if not (self.articles or page.canBeEdited()):
pywikibot.output(u"You can't edit page %s"
% page.title(asLink=True))
continue
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9009
Revision: 9009
Author: xqt
Date: 2011-02-25 10:06:42 +0000 (Fri, 25 Feb 2011)
Log Message:
-----------
bugfix for #3140832 introduced with r8762. Patch submitted by Andre Engels. Thanks a lot.
Modified Paths:
--------------
trunk/pywikipedia/titletranslate.py
Modified: trunk/pywikipedia/titletranslate.py
===================================================================
--- trunk/pywikipedia/titletranslate.py 2011-02-25 09:29:03 UTC (rev 9008)
+++ trunk/pywikipedia/titletranslate.py 2011-02-25 10:06:42 UTC (rev 9009)
@@ -81,7 +81,10 @@
for newcode in codes:
x = None
if newcode in family.langs.keys():
- if ( page is None ) or ( ( newcode != sitelang ) and ( not family.interwiki_forwarded_from ) ):
+ if page is None or \
+ (newcode != sitelang and
+ pywikibot.getSite().family.name
+ not in family.interwiki_forwarded_from):
x = pywikibot.Page(pywikibot.getSite(fam=family, code=newcode), newname)
elif newcode in family.interwiki_forwarded_from:
x = pywikibot.Page(pywikibot.getSite(fam=newcode, code=newcode), newname)
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9008
Revision: 9008
Author: xqt
Date: 2011-02-25 09:29:03 +0000 (Fri, 25 Feb 2011)
Log Message:
-----------
Check for edit conflict while reloading page during checking _editrestriction
see http://da.wikipedia.org/w/index.php?title=Barack_Obama&action=historysubmit…
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2011-02-25 07:18:08 UTC (rev 9007)
+++ trunk/pywikipedia/wikipedia.py 2011-02-25 09:29:03 UTC (rev 9008)
@@ -1698,8 +1698,16 @@
# If there is an unchecked edit restriction, we need to load the page
if self._editrestriction:
- output(u'Page %s is semi-protected. Getting edit page to find out if we are allowed to edit.' % self.aslink())
- self.get(force = True, change_edit_time = False)
+ output(
+u'Page %s is semi-protected. Getting edit page to find out if we are allowed to edit.'
+ % self.aslink())
+ oldtime = self.editTime()
+ # Note: change_edit_time=True is always True since
+ # self.get() calls self._getEditPage without this parameter
+ self.get(force=True, change_edit_time=True)
+ newtime = self.editTime()
+ if oldtime != newtime: # page was changed
+ raise EditConflict(u'Page has been changed after first read.')
self._editrestriction = False
# If no comment is given for the change, use the default
comment = comment or action