jenkins-bot has submitted this change and it was merged.
Change subject: Clarify error and message
......................................................................
Clarify error and message
One change is to narrow down an Error into InvalidTitle,
the other is to add the text itself to the message reporting
regex match against it.
Change-Id: Ibf120f025047e0dde27cd9af512526f444563949
---
M pywikibot/page.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 3883961..935331b 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3287,7 +3287,7 @@
if newsite == self._site:
if not t:
# Can't have an empty self-link
- raise pywikibot.Error(
+ raise pywikibot.InvalidTitle(
"Invalid link title: '%s'" % self._text)
firstPass = False
continue
@@ -3305,7 +3305,7 @@
m = Link.illegal_titles_pattern.search(t)
if m:
raise pywikibot.InvalidTitle(
- u"contains illegal char(s) '%s'" % m.group(0))
+ u"%s contains illegal char(s) %s" % (repr(t), repr(m.group(0))))
# Pages with "/./" or "/../" appearing in the URLs will
# often be unreachable due to the way web browsers deal
--
To view, visit https://gerrit.wikimedia.org/r/134813
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf120f025047e0dde27cd9af512526f444563949
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Whym <whym(a)whym.org>
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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: archivebot.py: count size by bytes instead of the number of characters
......................................................................
archivebot.py: count size by bytes instead of the number of characters
Using UTF-8 encoded bytes conforms with units used on MediaWiki history
pages and with the bot's documentations in the script and on-wiki.
Change-Id: I0f1170de4fb9856afbb63aa8e654dac5c9de0884
---
M scripts/archivebot.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index eea5189..407bd91 100644
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -215,7 +215,7 @@
self.timestamp = max(self.timestamp, timestamp)
def size(self):
- return len(self.title) + len(self.content) + 12
+ return len(self.title.encode('utf-8')) + len(self.content.encode('utf-8')) + 12
def toText(self):
return "== " + self.title + ' ==\n\n' + self.content
@@ -291,7 +291,7 @@
return self.full
def size(self):
- return len(self.header) + sum([t.size() for t in self.threads])
+ return len(self.header.encode('utf-8')) + sum(t.size() for t in self.threads)
def update(self, summary, sortThreads=False):
if sortThreads:
--
To view, visit https://gerrit.wikimedia.org/r/134318
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0f1170de4fb9856afbb63aa8e654dac5c9de0884
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Whym <whym(a)whym.org>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(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 URL in documentation
......................................................................
Fix URL in documentation
the old URL return 404 error
Change-Id: I2ba9428a365e66ed31c20afa9ca233dd095f573e
---
M pywikibot/xmlreader.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/xmlreader.py b/pywikibot/xmlreader.py
index f8db7ac..7b08695 100644
--- a/pywikibot/xmlreader.py
+++ b/pywikibot/xmlreader.py
@@ -4,7 +4,7 @@
Each XmlEntry object represents a page, as read from an XML source
The XmlDump class reads a pages_current XML dump (like the ones offered on
-http://download.wikimedia.org/wikipedia/de/) and offers a generator over
+http://dumps.wikimedia.org/backup-index.html) and offers a generator over
XmlEntry objects which can be used by other bots.
"""
#
--
To view, visit https://gerrit.wikimedia.org/r/134972
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2ba9428a365e66ed31c20afa9ca233dd095f573e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Update category.py to use action=move to move categories
......................................................................
Update category.py to use action=move to move categories
Add functionality to apply the new, previously unavailable
"action=move" function to category pages with category.py.
Check if the bot account has the "category-movepages" right,
if not then default to previous functionality.
Bug: 65115
Change-Id: I1a21e18da4f15ac8ba4eb0967fdbb64eafe5a4e6
---
M scripts/category.py
1 file changed, 5 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py
index 535b34d..3f31054 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -467,8 +467,11 @@
For readability it is splitted into several helper functions.
"""
if self.newcat and self.move_oldcat and not self.newcat.exists():
- self._movecat()
- self._movetalk()
+ if "move-categorypages" in self.site.userinfo["rights"]:
+ self.oldcat.move(self.newcat, reason=self.comment, movetalkpage=True)
+ else:
+ self._movecat()
+ self._movetalk()
if self.history:
self._hist()
self._change(pagegenerators.CategorizedPageGenerator(self.oldcat))
--
To view, visit https://gerrit.wikimedia.org/r/134776
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1a21e18da4f15ac8ba4eb0967fdbb64eafe5a4e6
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Withoutaname <drevitchi(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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: bugfix, code improvements
......................................................................
bugfix, code improvements
- fix identation error comming with
https://mediawiki.org/wiki/Special:Code/pywikipedia/2337
- use set for better performance instead of searching in a list
(maybe the the set should be returned)
- bugfix for verbose variable
- synchronize parts with compat
Change-Id: I88702e01270735890c903864f027e402508cd162
---
M pywikibot/titletranslate.py
1 file changed, 17 insertions(+), 18 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
Alex S.H. Lin: Checked; Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/titletranslate.py b/pywikibot/titletranslate.py
index 8421ef3..2a9bae6 100644
--- a/pywikibot/titletranslate.py
+++ b/pywikibot/titletranslate.py
@@ -2,7 +2,7 @@
#
# (C) Rob W.W. Hooft, 2003
# (C) Yuri Astrakhan, 2005
-# (C) Pywikibot team, 2003-2010
+# (C) Pywikibot team, 2003-2014
#
# Distributed under the terms of the MIT license.
#
@@ -12,6 +12,7 @@
import pywikibot
import pywikibot.date as date
+from pywikibot import config
def translate(page, hints=None, auto=True, removebrackets=False, site=None,
@@ -27,7 +28,7 @@
to all known target languages and inserted into the list.
"""
- result = []
+ result = set()
if site is None and page:
site = page.site
if family is None and site:
@@ -55,8 +56,8 @@
newname = page.title()
# ... unless we do want brackets
if removebrackets:
- newname = re.sub(re.compile(r"\W*?\(.*?\)\W*?", re.UNICODE),
- u" ", newname)
+ newname = re.sub(re.compile(r"\W*?\(.*?\)\W*?",
+ re.UNICODE), u" ", newname)
try:
number = int(codes)
codes = site.family.languages_by_size[:number]
@@ -71,10 +72,9 @@
if newcode in site.languages():
if newcode != site.code:
x = pywikibot.Link(newname, site.getSite(code=newcode))
- if x not in result:
- result.append(x)
+ result.add(x)
else:
- if pywikibot.verbose:
+ if config.verbose_output:
pywikibot.output(u"Ignoring unknown language code %s"
% newcode)
@@ -82,20 +82,20 @@
# existing interwiki links.
if auto and page:
# search inside all dictionaries for this link
- dictName, value = date.getAutoFormat(page.site.code,
- page.title())
+ sitelang = page.site.code
+ dictName, value = date.getAutoFormat(sitelang, page.title())
if dictName:
if not (dictName == 'yearsBC' and
- page.site.code in date.maxyearBC and
- value > date.maxyearBC[page.site.code]) or \
+ sitelang in date.maxyearBC and
+ value > date.maxyearBC[sitelang]) or \
(dictName == 'yearsAD' and
- page.site.code in date.maxyearAD and
- value > date.maxyearAD[page.site.code]):
+ sitelang in date.maxyearAD and
+ value > date.maxyearAD[sitelang]):
pywikibot.output(
u'TitleTranslate: %s was recognized as %s with value %d'
% (page.title(), dictName, value))
for entryLang, entry in date.formats[dictName].items():
- if entryLang != page.site.code:
+ if entryLang != sitelang:
if (dictName == 'yearsBC' and
entryLang in date.maxyearBC and
value > date.maxyearBC[entryLang]):
@@ -104,15 +104,14 @@
entryLang in date.maxyearAD and
value > date.maxyearAD[entryLang]):
pass
- else:
+ else:
newname = entry(value)
x = pywikibot.Link(
newname,
pywikibot.Site(code=entryLang,
fam=site.family))
- if x not in result:
- result.append(x) # add new page
- return result
+ result.add(x)
+ return list(result)
bcDateErrors = [u'[[ko:%d년]]']
--
To view, visit https://gerrit.wikimedia.org/r/134338
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I88702e01270735890c903864f027e402508cd162
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Alex S.H. Lin <alexsh(a)mail2000.com.tw>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [L10N] set translation fallback=True for fix message
......................................................................
[L10N] set translation fallback=True for fix message
needed since fallback is False per default
Change-Id: I1e57ecf1527ae2be76529938c6f059c79da216ec
---
M scripts/replace.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/replace.py b/scripts/replace.py
index df6c215..20582b9 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -619,7 +619,7 @@
str(fix['msg']))
else:
edit_summary = pywikibot.translate(pywikibot.Site(),
- fix['msg'])
+ fix['msg'], fallback=True)
if "exceptions" in fix:
exceptions = fix['exceptions']
if "nocase" in fix:
--
To view, visit https://gerrit.wikimedia.org/r/133674
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1e57ecf1527ae2be76529938c6f059c79da216ec
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: jenkins-bot <>