jenkins-bot has submitted this change and it was merged.
Change subject: Changed Page.change_category for category_redirect
......................................................................
Changed Page.change_category for category_redirect
Note #1: Page.change_category now returns True or
False instead of always None.
Note #2: The category_redirect version of
change_category saves the page also if it is
not changed. Since MediaWiki automatically
purges pages this is imho not needed. The
original does not do this.
Note #3: This should fix the bug reported in bug 59119
Change-Id: I0dd0c3758b3c6dfa542ddba44fc6139a9b415d3e
---
M pywikibot/page.py
1 file changed, 6 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index f0150cd..6504d10 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1455,6 +1455,7 @@
@param inPlace: if True, change categories in place rather than
rearranging them.
+ @return: True if page was saved changed, otherwise False.
"""
# get list of Category objects the article is in and remove possible
@@ -1472,12 +1473,12 @@
if not self.canBeEdited():
pywikibot.output(u"Can't edit %s, skipping it..."
% self.title(asLink=True))
- return
+ return False
if oldCat not in cats:
pywikibot.error(u'%s is not in category %s!'
% (self.title(asLink=True), oldCat.title()))
- return
+ return False
if inPlace or self.namespace() == 10:
oldtext = self.get(get_redirect=True)
@@ -1496,10 +1497,12 @@
# a ValueError is in the case of interwiki links to self.
pywikibot.output(u'Skipping %s because of interwiki link to '
u'self' % self.title())
+ return False
if oldtext != newtext:
try:
self.put(newtext, comment)
+ return True
except pywikibot.EditConflict:
pywikibot.output(u'Skipping %s because of edit conflict'
% self.title())
@@ -1515,6 +1518,7 @@
except pywikibot.PageNotSaved as error:
pywikibot.output(u'Saving page %s failed: %s'
% (self.title(asLink=True), error.message))
+ return False
@property
def categoryinfo(self):
--
To view, visit https://gerrit.wikimedia.org/r/104669
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0dd0c3758b3c6dfa542ddba44fc6139a9b415d3e
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Pyfisch <pyfisch(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Alex S.H. Lin has submitted this change and it was merged.
Change subject: remove obsolete imports, remove queryViaWeb() method
......................................................................
remove obsolete imports, remove queryViaWeb() method
queryViaWeb() was commented because it is probably not in
compliance with Google's "Terms of service"
Change-Id: Ibb9c34e40158bad8e2b498fe7ca207541054e9da
---
M pagegenerators.py
1 file changed, 0 insertions(+), 39 deletions(-)
Approvals:
Alex S.H. Lin: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/pagegenerators.py b/pagegenerators.py
index 5b0c70d..933526a 100644
--- a/pagegenerators.py
+++ b/pagegenerators.py
@@ -21,13 +21,11 @@
__version__ = '$Id$'
import re
-import sys
import codecs
import date
import datetime
import time
import urllib
-import urllib2
import traceback
import wikipedia as pywikibot
import config
@@ -1001,43 +999,6 @@
estimatedTotalResultsCount = data.meta.estimatedTotalResultsCount
#print 'estimatedTotalResultsCount: ', estimatedTotalResultsCount
offset += 10
-
-#############
-## commented out because it is probably not in compliance with Google's
-## "Terms of service" (see 5.3, http://www.google.com/accounts/TOS?loc=US)
-##
-## def queryViaWeb(self, query):
-## """
-## Google has stopped giving out API license keys, and sooner or later
-## they will probably shut down the service.
-## This is a quick and ugly solution: we just grab the search results from
-## the normal web interface.
-## """
-## linkR = re.compile(r'<a href="([^>"]+?)" class=l>', re.IGNORECASE)
-## offset = 0
-##
-## while True:
-## pywikibot.output("Google: Querying page %d" % (offset / 100 + 1))
-## address = "http://www.google.com/search?q=%s&num=100&hl=en&start=%d" \
-## % (urllib.quote_plus(query), offset)
-## # we fake being Firefox because Google blocks unknown browsers
-## request = urllib2.Request(
-## address, None,
-## {'User-Agent':
-## 'Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8) Gecko/20051128 '
-## 'SUSE/1.5-0.1 Firefox/1.5'})
-## urlfile = urllib2.urlopen(request)
-## page = urlfile.read()
-## urlfile.close()
-## for url in linkR.findall(page):
-## yield url
-##
-## # Is there a "Next" link for next page of results?
-## if "<div id=nn>" in page:
-## offset += 100 # Yes, go to next page of results.
-## else:
-## return
-#############
def __iter__(self):
# restrict query to local site
--
To view, visit https://gerrit.wikimedia.org/r/104333
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibb9c34e40158bad8e2b498fe7ca207541054e9da
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Alex S.H. Lin <alexsh(a)mail2000.com.tw>
Gerrit-Reviewer: Andre Engels <andreengels(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Purodha <publi(a)web.de>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Fix bugs in textlib.py
......................................................................
Fix bugs in textlib.py
* Fixed undefined name Error
* Fixed broken link
* Renamed PyWikipediaBot to Pywikibot
Change-Id: Ie14d14edb7e92f8463bf4983804cb3e54ff012a0
---
M pywikibot/textlib.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 751634c..6624158 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -774,11 +774,11 @@
if site is None:
site = pywikibot.getSite()
if site.sitename() == 'wikipedia:de' and "{{Personendaten" in oldtext:
- raise Error("""\
-The PyWikipediaBot is no longer allowed to touch categories on the German
+ raise pywikibot.Error("""\
+The Pywikibot is no longer allowed to touch categories on the German
Wikipedia on pages that contain the Personendaten template because of the
non-standard placement of that template.
-See http://de.wikipedia.org/wiki/Hilfe_Diskussion:Personendaten/Archiv/bis_2006…
+See http://de.wikipedia.org/wiki/Hilfe_Diskussion:Personendaten/Archiv/1#Positi…
""")
separator = site.family.category_text_separator
iseparator = site.family.interwiki_text_separator
--
To view, visit https://gerrit.wikimedia.org/r/104194
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie14d14edb7e92f8463bf4983804cb3e54ff012a0
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Pyfisch <pyfisch(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: fix spelling in inline comments
......................................................................
fix spelling in inline comments
Change-Id: Iabe092f17fe9dd74f4beaf78fabed4aaff65a439
---
M date.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/date.py b/date.py
index da3e246..837bf5e 100644
--- a/date.py
+++ b/date.py
@@ -2242,8 +2242,8 @@
'DecadeBC': (lambda v: 0 <= v and v < 4001, 0, 501), # zh: has decades as old as 前1700年代
'CenturyAD': (lambda v: 1 <= v and v < 41, 1, 23), # Some centuries use Roman numerals or a given list - do not exceed them in testing
'CenturyBC': (lambda v: 1 <= v and v < 91, 1, 23), # Some centuries use Roman numerals or a given list - do not exceed them in testing
- 'MillenniumAD': (lambda v: 1 <= v and v < 6, 1, 4), # For milleniums, only test first 3 AD Milleniums,
- 'MillenniumBC': (lambda v: 1 <= v and v < 20, 1, 2), # And only 1 BC Millenium
+ 'MillenniumAD': (lambda v: 1 <= v and v < 6, 1, 4), # For millenniums, only test first 3 AD Millenniums,
+ 'MillenniumBC': (lambda v: 1 <= v and v < 20, 1, 2), # And only 1 BC Millennium
'CenturyAD_Cat': (lambda v: 1 <= v and v < 41, 1, 23), # Some centuries use Roman numerals or a given list - do not exceed them in testing
'CenturyBC_Cat': (lambda v: 1 <= v and v < 41, 1, 23), # Some centuries use Roman numerals or a given list - do not exceed them in testing
'Cat_Year_MusicAlbums': (lambda v: 1950 <= v and v < 2021, 1950, 2021),
--
To view, visit https://gerrit.wikimedia.org/r/104488
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iabe092f17fe9dd74f4beaf78fabed4aaff65a439
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: fixed spelling in called function name, update from compat
......................................................................
fixed spelling in called function name, update from compat
Change-Id: Ib5cf5e7c5b6fe0e103dd4899dee69d216bd90bd3
---
M pywikibot/date.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/date.py b/pywikibot/date.py
index 6e39e96..ad57e2c 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -1581,7 +1581,7 @@
lambda p: p == 4),
(lambda v: dh_constVal(v, 5, u'Föfte Johdousend'),
lambda p: p == 5),
- (lambda v: dh_milleniumAD(v, u'%d. Johdousend'), alwaysTrue)]),
+ (lambda v: dh_millenniumAD(v, u'%d. Johdousend'), alwaysTrue)]),
'lb': lambda v: dh_millenniumAD(v, u'%d. Joerdausend'),
'mhr': lambda v: dh_millenniumAD(v, u'%R. курым — '),
'lt': lambda v: dh_millenniumAD(v, u'%d tūkstantmetis'),
@@ -2246,8 +2246,8 @@
'DecadeBC': (lambda v: 0 <= v and v < 4001, 0, 501), # zh: has decades as old as 前1700年代
'CenturyAD': (lambda v: 1 <= v and v < 41, 1, 23), # Some centuries use Roman numerals or a given list - do not exceed them in testing
'CenturyBC': (lambda v: 1 <= v and v < 91, 1, 23), # Some centuries use Roman numerals or a given list - do not exceed them in testing
- 'MillenniumAD': (lambda v: 1 <= v and v < 6, 1, 4), # For milleniums, only test first 3 AD Milleniums,
- 'MillenniumBC': (lambda v: 1 <= v and v < 20, 1, 2), # And only 1 BC Millenium
+ 'MillenniumAD': (lambda v: 1 <= v and v < 6, 1, 4), # For millenniums, only test first 3 AD Millenniums,
+ 'MillenniumBC': (lambda v: 1 <= v and v < 20, 1, 2), # And only 1 BC Millennium
'CenturyAD_Cat': (lambda v: 1 <= v and v < 41, 1, 23), # Some centuries use Roman numerals or a given list - do not exceed them in testing
'CenturyBC_Cat': (lambda v: 1 <= v and v < 41, 1, 23), # Some centuries use Roman numerals or a given list - do not exceed them in testing
'Cat_Year_MusicAlbums': (lambda v: 1950 <= v and v < 2021, 1950, 2021),
--
To view, visit https://gerrit.wikimedia.org/r/104489
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib5cf5e7c5b6fe0e103dd4899dee69d216bd90bd3
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot