jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/472748 )
Change subject: Add .vscode in .gitignore
......................................................................
Add .vscode in .gitignore
.vscode is directory for configuration file(s) which Visual Studio Code
automatically creates and shouldn't be committed
Change-Id: I9d47dfec325b405680b97e6c3355d348f9c47a3e
---
M .gitignore
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
Thiemo Kreuz (WMDE): Looks good to me, but someone else must approve
D3r1ck01: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.gitignore b/.gitignore
index ec60fac..cefdbd2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@
docs/_build/
/scripts/userscripts/*
!/scripts/userscripts/__init__.py
+.vscode/
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/472748
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I9d47dfec325b405680b97e6c3355d348f9c47a3e
Gerrit-Change-Number: 472748
Gerrit-PatchSet: 6
Gerrit-Owner: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Thiemo Kreuz (WMDE) <thiemo.kreuz(a)wikimedia.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/472764 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: I78b4df67be6ee7e4823c6e43473b0ef27ab1ae23
---
M HISTORY.rst
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 061ba04..bb4c506 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,10 @@
Current release
---------------
+* Prevent touch from re-creating pages (T193833)
+* New Page.title() parameter without_brackets; also used by titletranslate (T200399)
+* Security: require requests version 2.20.0 or later (T208296)
+* Check appropriate key in Site.messages (T163661)
* Make sure the cookie file is created with the right permissions (T206387)
* pydot >= 1.2 is required for interwiki_graph
* Move methods for simple claim adding/removing to WikibasePage (T113131)
--
To view, visit https://gerrit.wikimedia.org/r/472764
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I78b4df67be6ee7e4823c6e43473b0ef27ab1ae23
Gerrit-Change-Number: 472764
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/471765 )
Change subject: [IMPR] Use page.title(without_brackets) for titletranslate
......................................................................
[IMPR] Use page.title(without_brackets) for titletranslate
Use the newly added title parameter without_brackets to build a title
without trailing brackets including their content.
The behavior is changed a bit by only remove the last bracket content whereas
the previous implementation also could remove bracket content at the beginning
of the page title which isn't what the -hintnobracket of interwiki suggests.
Change-Id: Ie6a662489df25430aa37c22e9e3dd2d59f3161ce
---
M pywikibot/titletranslate.py
M scripts/interwiki.py
2 files changed, 3 insertions(+), 8 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/titletranslate.py b/pywikibot/titletranslate.py
index 8868ef2..5117372 100644
--- a/pywikibot/titletranslate.py
+++ b/pywikibot/titletranslate.py
@@ -9,8 +9,6 @@
#
from __future__ import absolute_import, division, unicode_literals
-import re
-
import pywikibot
from pywikibot import date
@@ -47,11 +45,8 @@
# we're currently working on ...
if page is None:
continue
- newname = page.title(with_ns=False)
- # ... unless we do want brackets
- if removebrackets:
- newname = re.sub(re.compile(r'\W*?\(.*?\)\W*?',
- re.UNICODE), ' ', newname)
+ newname = page.title(with_ns=False,
+ without_brackets=removebrackets)
if codes.isdigit():
codes = site.family.languages_by_size[:int(codes)]
elif codes == 'all':
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 4a325a3..f8909bd 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -197,7 +197,7 @@
dates, only use found links and hints.
(note: without ending colon)
- -hintnobracket used to make the bot strip everything in brackets,
+ -hintnobracket used to make the bot strip everything in last brackets,
and surrounding spaces from the page name, before it is
used in a -hint:xy: where the page name has been left out,
or -hint:all:, -hint:10:, etc. without a name, or
--
To view, visit https://gerrit.wikimedia.org/r/471765
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie6a662489df25430aa37c22e9e3dd2d59f3161ce
Gerrit-Change-Number: 471765
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/470627 )
Change subject: [IMPR] Strip disambiguation parens from articles
......................................................................
[IMPR] Strip disambiguation parens from articles
Add a parameter to remove disambiguation parentheses from names of
newly created items. It cannot not be used in conjunction with
`as_link`.
Bug: T200399
Change-Id: I77b3ef1a6c6b690ba73f4e43709506adfc9b1ed4
---
M pywikibot/bot.py
M pywikibot/page.py
M tests/page_tests.py
3 files changed, 19 insertions(+), 2 deletions(-)
Approvals:
D3r1ck01: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index d3fa757..5cb9b06 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -2141,7 +2141,7 @@
data.setdefault('labels', {}).update({
page.site.lang: {
'language': page.site.lang,
- 'value': page.title()
+ 'value': page.title(without_brackets=page.namespace() == 0)
}
})
pywikibot.output('Creating item for %s...' % page)
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 2f78e30..c033a7d 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -294,7 +294,7 @@
def title(self, underscore=False, with_ns=True,
with_section=True, as_url=False, as_link=False,
allow_interwiki=True, force_interwiki=False, textlink=False,
- as_filename=False, insite=None):
+ as_filename=False, insite=None, without_brackets=False):
"""
Return the title of this Page, as a Unicode string.
@@ -318,6 +318,8 @@
@param insite: (only used if as_link is true) a site object where the
title is to be shown. default is the current family/lang given by
-family and -lang option i.e. config.family and config.mylang
+ @param without_brackets: (cannot be used with as_link) if true, remove
+ the last pair of brackets(usually removes disambiguation brackets).
@rtype: unicode
"""
title = self._link.canonical_title()
@@ -357,6 +359,9 @@
title = label + section
else:
title += section
+ if without_brackets:
+ brackets_re = r'\s+\([^()]+?\)$'
+ title = re.sub(brackets_re, '', title)
if underscore or as_url:
title = title.replace(' ', '_')
if as_url:
diff --git a/tests/page_tests.py b/tests/page_tests.py
index 4cc8062..4b99130 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -391,6 +391,18 @@
force_interwiki=True, insite=site),
'[[' + site.code + ':Test page|Test page]]')
+ title1 = 'Test Page (bracketed)'
+ title2 = 'Test Page (bracketed) (bracketed)'
+
+ self.assertEqual(
+ pywikibot.Page(site, title1).title(without_brackets=True),
+ 'Test Page'
+ )
+ self.assertEqual(
+ pywikibot.Page(site, title2).title(without_brackets=True),
+ 'Test Page (bracketed)'
+ )
+
def testSection(self):
"""Test section() method."""
# use same pages as in previous test
--
To view, visit https://gerrit.wikimedia.org/r/470627
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I77b3ef1a6c6b690ba73f4e43709506adfc9b1ed4
Gerrit-Change-Number: 470627
Gerrit-PatchSet: 24
Gerrit-Owner: Shreyasminocha <shreyasminocha(a)protonmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Shreyasminocha <shreyasminocha(a)protonmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Rafidaslam <rafidteam(a)gmail.com>