jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/507247 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: I7cff3f9f3cab523a82c166f592112b5a0bd7ee6a
---
M HISTORY.rst
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
D3r1ck01: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 2e210b8..badfee2 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,7 @@
Current release
---------------
+* Don't fail if the number of forms of a plural string is less than required (T99057, T219097)
* Implement create_short_link Page method to use Extension:UrlShortener (T220876)
* Remove wikia family file (T220921)
* Remove deprecated ez_setup.py
--
To view, visit https://gerrit.wikimedia.org/r/507247
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: I7cff3f9f3cab523a82c166f592112b5a0bd7ee6a
Gerrit-Change-Number: 507247
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
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/507342 )
Change subject: [doc] Fix doc warning introduced in 6b8810865e
......................................................................
[doc] Fix doc warning introduced in 6b8810865e
Change-Id: Iff22c9b38603ee67947fe51a0617b7fd75ddb9b2
---
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 b4cfd5f..abb343d 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2220,10 +2220,10 @@
that site to create the link instead of the current wiki.
@param permalink: If true, the link will point to the actual revision
- of the page.
+ of the page.
@type permalink: bool
@param with_protocol: If true, the link will have https propotol
- prepend.
+ prepend.
@type with_protocol: bool
@return: The reduced link.
@rtype: str
--
To view, visit https://gerrit.wikimedia.org/r/507342
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: Iff22c9b38603ee67947fe51a0617b7fd75ddb9b2
Gerrit-Change-Number: 507342
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
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/507016 )
Change subject: Revert "pywikibot: Add support for property creation"
......................................................................
Revert "pywikibot: Add support for property creation"
Revert due to failing tests:
https://travis-ci.org/wikimedia/pywikibot/jobs/525944446
This reverts commit c3c937a01dfd2aa985a160a5104538edb49aeab7.
Change-Id: I1b531c644850f419e5df3fa93d3f83711065dc83
---
M pywikibot/page.py
M pywikibot/site.py
M tests/wikibase_edit_tests.py
3 files changed, 19 insertions(+), 84 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 27df20e..a07bf9c 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3956,16 +3956,6 @@
'claims': self.claims,
}
- def get_data_for_new_entity(self):
- """
- Return data required for creation of new page.
-
- Override it if you need.
-
- @rtype: dict
- """
- return {}
-
def _diff_to(self, type_key, key_name, value_name, diffto, data):
assert type_key not in data, 'Key type must be defined in data'
source = self._normalizeLanguages(getattr(self, type_key)).copy()
@@ -4196,7 +4186,7 @@
else:
data = WikibasePage._normalizeData(data)
- updates = self.repo.editEntity(self, data,
+ updates = self.repo.editEntity(self._defined_by(singular=True), data,
baserevid=baserevid, **kwargs)
self.latest_revision_id = updates['entity']['lastrevid']
@@ -4761,43 +4751,29 @@
A Wikibase entity in the property namespace.
Should be created as::
+
PropertyPage(DataSite, 'P21')
- or
- PropertyPage(DataSite, datatype='url')
"""
_cache_attrs = WikibasePage._cache_attrs + ('_type',)
entity_type = 'property'
- title_pattern = r'^(P[1-9]\d*|-1)$'
+ title_pattern = r'^P[1-9]\d*$'
- def __init__(self, source, title=None, datatype=None):
+ def __init__(self, source, title=''):
"""
Initializer.
@param source: data repository property is on
@type source: pywikibot.site.DataSite
- @param title: page name of property, like "P##",
- "-1" or None for an empty property.
+ @param title: page name of property, like "P##"
@type title: str
- @param datatype: Datatype for a new property.
- @type datatype: str
"""
- # Special case for new property.
- if title is None or title == '-1':
- if not datatype:
- raise TypeError('"datatype" is required for new property.')
- WikibasePage.__init__(self, source, '-1',
- ns=source.property_namespace)
- Property.__init__(self, source, '-1', datatype=datatype)
- assert self.id == '-1'
- else:
- if not title:
- raise pywikibot.InvalidTitle(
- "Property's title cannot be empty")
+ if not title:
+ raise pywikibot.InvalidTitle("Property's title cannot be empty")
- WikibasePage.__init__(self, source, title,
- ns=source.property_namespace)
- Property.__init__(self, source, self.id)
+ WikibasePage.__init__(self, source, title,
+ ns=source.property_namespace)
+ Property.__init__(self, source, self.id)
def get(self, force=False, *args, **kwargs):
"""
@@ -4826,10 +4802,6 @@
return Claim(self.site, self.getID(), datatype=self.type,
*args, **kwargs)
- def get_data_for_new_entity(self):
- """Return data required for creation of new property."""
- return {'datatype': self.type}
-
# Add PropertyPage to the class attribute "types" after its declaration.
Property.types['wikibase-property'] = PropertyPage
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 977d7dd..26c11c4 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -7785,17 +7785,13 @@
return dtype
- @deprecated_args(identification='entity')
@must_be(group='user')
- def editEntity(self, entity, data, bot=True, **kwargs):
+ def editEntity(self, identification, data, bot=True, **kwargs):
"""
Edit entity.
- Note: This method is unable to create entities other than 'item'
- if dict with API parameters was passed to 'entity' parameter.
- @param entity: Page to edit, or dict with API parameters
- to use for entity identification
- @type entity: WikibasePage or dict
+ @param identification: API parameters to use for entity identification
+ @type identification: dict
@param data: data updates
@type data: dict
@param bot: Whether to mark the edit as a bot edit
@@ -7803,23 +7799,11 @@
@return: New entity data
@rtype: dict
"""
- # this changes the reference to a new object
- data = dict(data)
- if isinstance(entity, pywikibot.page.WikibasePage):
- params = entity._defined_by(singular=True)
- if 'id' in params and params['id'] == '-1':
- del params['id']
- if not params:
- params['new'] = entity.entity_type
- data_for_new_entity = entity.get_data_for_new_entity()
- data.update(data_for_new_entity)
- else:
- if 'id' in entity and entity['id'] == '-1':
- del entity['id']
- params = dict(entity)
- if not params: # If no identification was provided
- params['new'] = 'item'
-
+ if 'id' in identification and identification['id'] == '-1':
+ del identification['id']
+ params = dict(**identification)
+ if not params: # If no identification was provided
+ params['new'] = 'item' # TODO create properties+queries
params['action'] = 'wbeditentity'
if bot:
params['bot'] = 1
@@ -7828,7 +7812,7 @@
params['token'] = self.tokens['edit']
for arg in kwargs:
- if arg in ['clear', 'summary']:
+ if arg in ['clear', 'data', 'summary']:
params[arg] = kwargs[arg]
elif arg != 'baserevid':
warn('Unknown wbeditentity parameter {0} ignored'.format(arg),
diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index 13a5a6b..69e61e8 100644
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -128,27 +128,6 @@
item = pywikibot.ItemPage(testsite)
item.editEntity(data)
- def test_edit_entity_new_property(self):
- """Test creating a new property using C{PropertyPage.editEntity}."""
- testsite = self.get_repo()
- ts = str(time.time())
- data = {
- 'labels': {
- 'en': {
- 'language': 'en',
- 'value': 'Pywikibot test new property',
- }
- },
- 'descriptions': {
- 'en': {
- 'language': 'en',
- 'value': 'Pywikibot test new property - ' + ts,
- }
- }
- }
- prop = pywikibot.PropertyPage(testsite, datatype='string')
- prop.editEntity(data)
-
def test_edit_entity_new_linked_item(self):
"""Test linking a page using a new item."""
ts = str(time.time())
--
To view, visit https://gerrit.wikimedia.org/r/507016
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: I1b531c644850f419e5df3fa93d3f83711065dc83
Gerrit-Change-Number: 507016
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: 813gan <813gan(a)protonmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Aklapper <aklapper(a)wikimedia.org>
Gerrit-CC: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-CC: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-CC: Welcome, new contributor! <ssethi(a)wikimedia.org>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/497646 )
Change subject: pywikibot: Add support for property creation
......................................................................
pywikibot: Add support for property creation
Changed PropertyPages constructor to accept empty title and
added 'datatype' parameter. Added method 'get_data_for_new_entity'
to PropertyPage. PropertyPage can now have id '-1'.
Changed DataSite.editEntity method to accept WikibasePage
as first argument. Renamed argument 'identification' to 'entity'.
Bug: T160402
Change-Id: Ibe316b55f226d704dfab11db7dc16f1b788a7213
---
M pywikibot/page.py
M pywikibot/site.py
M tests/wikibase_edit_tests.py
3 files changed, 84 insertions(+), 19 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index a07bf9c..27df20e 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3956,6 +3956,16 @@
'claims': self.claims,
}
+ def get_data_for_new_entity(self):
+ """
+ Return data required for creation of new page.
+
+ Override it if you need.
+
+ @rtype: dict
+ """
+ return {}
+
def _diff_to(self, type_key, key_name, value_name, diffto, data):
assert type_key not in data, 'Key type must be defined in data'
source = self._normalizeLanguages(getattr(self, type_key)).copy()
@@ -4186,7 +4196,7 @@
else:
data = WikibasePage._normalizeData(data)
- updates = self.repo.editEntity(self._defined_by(singular=True), data,
+ updates = self.repo.editEntity(self, data,
baserevid=baserevid, **kwargs)
self.latest_revision_id = updates['entity']['lastrevid']
@@ -4751,29 +4761,43 @@
A Wikibase entity in the property namespace.
Should be created as::
-
PropertyPage(DataSite, 'P21')
+ or
+ PropertyPage(DataSite, datatype='url')
"""
_cache_attrs = WikibasePage._cache_attrs + ('_type',)
entity_type = 'property'
- title_pattern = r'^P[1-9]\d*$'
+ title_pattern = r'^(P[1-9]\d*|-1)$'
- def __init__(self, source, title=''):
+ def __init__(self, source, title=None, datatype=None):
"""
Initializer.
@param source: data repository property is on
@type source: pywikibot.site.DataSite
- @param title: page name of property, like "P##"
+ @param title: page name of property, like "P##",
+ "-1" or None for an empty property.
@type title: str
+ @param datatype: Datatype for a new property.
+ @type datatype: str
"""
- if not title:
- raise pywikibot.InvalidTitle("Property's title cannot be empty")
+ # Special case for new property.
+ if title is None or title == '-1':
+ if not datatype:
+ raise TypeError('"datatype" is required for new property.')
+ WikibasePage.__init__(self, source, '-1',
+ ns=source.property_namespace)
+ Property.__init__(self, source, '-1', datatype=datatype)
+ assert self.id == '-1'
+ else:
+ if not title:
+ raise pywikibot.InvalidTitle(
+ "Property's title cannot be empty")
- WikibasePage.__init__(self, source, title,
- ns=source.property_namespace)
- Property.__init__(self, source, self.id)
+ WikibasePage.__init__(self, source, title,
+ ns=source.property_namespace)
+ Property.__init__(self, source, self.id)
def get(self, force=False, *args, **kwargs):
"""
@@ -4802,6 +4826,10 @@
return Claim(self.site, self.getID(), datatype=self.type,
*args, **kwargs)
+ def get_data_for_new_entity(self):
+ """Return data required for creation of new property."""
+ return {'datatype': self.type}
+
# Add PropertyPage to the class attribute "types" after its declaration.
Property.types['wikibase-property'] = PropertyPage
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 26c11c4..977d7dd 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -7785,13 +7785,17 @@
return dtype
+ @deprecated_args(identification='entity')
@must_be(group='user')
- def editEntity(self, identification, data, bot=True, **kwargs):
+ def editEntity(self, entity, data, bot=True, **kwargs):
"""
Edit entity.
- @param identification: API parameters to use for entity identification
- @type identification: dict
+ Note: This method is unable to create entities other than 'item'
+ if dict with API parameters was passed to 'entity' parameter.
+ @param entity: Page to edit, or dict with API parameters
+ to use for entity identification
+ @type entity: WikibasePage or dict
@param data: data updates
@type data: dict
@param bot: Whether to mark the edit as a bot edit
@@ -7799,11 +7803,23 @@
@return: New entity data
@rtype: dict
"""
- if 'id' in identification and identification['id'] == '-1':
- del identification['id']
- params = dict(**identification)
- if not params: # If no identification was provided
- params['new'] = 'item' # TODO create properties+queries
+ # this changes the reference to a new object
+ data = dict(data)
+ if isinstance(entity, pywikibot.page.WikibasePage):
+ params = entity._defined_by(singular=True)
+ if 'id' in params and params['id'] == '-1':
+ del params['id']
+ if not params:
+ params['new'] = entity.entity_type
+ data_for_new_entity = entity.get_data_for_new_entity()
+ data.update(data_for_new_entity)
+ else:
+ if 'id' in entity and entity['id'] == '-1':
+ del entity['id']
+ params = dict(entity)
+ if not params: # If no identification was provided
+ params['new'] = 'item'
+
params['action'] = 'wbeditentity'
if bot:
params['bot'] = 1
@@ -7812,7 +7828,7 @@
params['token'] = self.tokens['edit']
for arg in kwargs:
- if arg in ['clear', 'data', 'summary']:
+ if arg in ['clear', 'summary']:
params[arg] = kwargs[arg]
elif arg != 'baserevid':
warn('Unknown wbeditentity parameter {0} ignored'.format(arg),
diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index 69e61e8..13a5a6b 100644
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -128,6 +128,27 @@
item = pywikibot.ItemPage(testsite)
item.editEntity(data)
+ def test_edit_entity_new_property(self):
+ """Test creating a new property using C{PropertyPage.editEntity}."""
+ testsite = self.get_repo()
+ ts = str(time.time())
+ data = {
+ 'labels': {
+ 'en': {
+ 'language': 'en',
+ 'value': 'Pywikibot test new property',
+ }
+ },
+ 'descriptions': {
+ 'en': {
+ 'language': 'en',
+ 'value': 'Pywikibot test new property - ' + ts,
+ }
+ }
+ }
+ prop = pywikibot.PropertyPage(testsite, datatype='string')
+ prop.editEntity(data)
+
def test_edit_entity_new_linked_item(self):
"""Test linking a page using a new item."""
ts = str(time.time())
--
To view, visit https://gerrit.wikimedia.org/r/497646
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: Ibe316b55f226d704dfab11db7dc16f1b788a7213
Gerrit-Change-Number: 497646
Gerrit-PatchSet: 8
Gerrit-Owner: 813gan <813gan(a)protonmail.com>
Gerrit-Reviewer: 813gan <813gan(a)protonmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Aklapper <aklapper(a)wikimedia.org>
Gerrit-CC: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-CC: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-CC: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-CC: Welcome, new contributor! <ssethi(a)wikimedia.org>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/502536 )
Change subject: [bugfix] Take the last plural entry if we don't have enough
......................................................................
[bugfix] Take the last plural entry if we don't have enough
As noted in https://translatewiki.net/wiki/Plural#Plural_syntax_in_MediaWiki
if the number of forms written is less than the number of forms required by
the plural rules of the language, the last available form will be used for
all missing forms.
Bug: T219097
Bug: T99057
Change-Id: I7bbdd93a0b753e19123afe8ae956437416ec86c1
---
M pywikibot/i18n.py
M tests/i18n_tests.py
2 files changed, 30 insertions(+), 7 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index ca6168d..092395a 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -499,11 +499,9 @@
assert index == 0
if index >= len(plural_entries):
- raise IndexError(
- 'language "{}" requires {} plural variants for "{}" but '
- 'only {} ("{}") provided'.format(
- code, needed, selector, len(plural_entries),
- '", "'.join(plural_entries)))
+ # take the last entry in that case, see
+ # https://translatewiki.net/wiki/Plural#Plural_syntax_in_MediaWiki
+ index = -1
return plural_entries[index]
assert isinstance(parameters, Mapping), \
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index 3b700fe..1ee14f8 100644
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -452,8 +452,11 @@
self.assertEqual(
i18n._extract_plural('en', '{{PLURAL:foo|one|}}', {'foo': 1}),
'one')
- with self.assertRaises(IndexError):
- i18n._extract_plural('en', '{{PLURAL:foo|one}}', {'foo': 0})
+
+ # two variants expected but only one given
+ self.assertEqual(
+ i18n._extract_plural('en', '{{PLURAL:foo|one}}', {'foo': 0}),
+ 'one')
def test_specific(self):
"""Test using a specific plural."""
@@ -466,6 +469,28 @@
{'foo': 12}),
'dozen')
+ def test_more(self):
+ """Test the number of plurals are more than expected."""
+ test = [(0, 2), (1, 0), (2, 1), (3, 2), (4, 2), (7, 2), (8, 3)]
+ for num, result in test:
+ self.assertEqual(
+ i18n._extract_plural(
+ 'cy',
+ '{{PLURAL:num|0|1|2|3|4|5}}',
+ {'num': num}),
+ str(result))
+
+ def test_less(self):
+ """Test the number of plurals are less than expected."""
+ test = [(0, 2), (1, 0), (2, 1), (3, 2), (4, 2), (7, 2), (8, 3)]
+ for num, result in test:
+ self.assertEqual(
+ i18n._extract_plural(
+ 'cy',
+ '{{PLURAL:num|0|1}}',
+ {'num': num}),
+ str(min(result, 1)))
+
if __name__ == '__main__': # pragma: no cover
try:
--
To view, visit https://gerrit.wikimedia.org/r/502536
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: I7bbdd93a0b753e19123afe8ae956437416ec86c1
Gerrit-Change-Number: 502536
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: MarcoAurelio <maurelio(a)tools.wmflabs.org>
Gerrit-Reviewer: Nikerabbit <niklas.laxstrom(a)gmail.com>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
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/505630 )
Change subject: [IMPR] Simplify month_delta test in apply_month_delta
......................................................................
[IMPR] Simplify month_delta test in apply_month_delta
Change-Id: Iff0679ff62dba9f51be604e55b0bc539fec6beaa
---
M pywikibot/date.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/date.py b/pywikibot/date.py
index fb761cb..aecefd1 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -2360,7 +2360,7 @@
@return: The end date
@rtype: type of date
"""
- if int(month_delta) != month_delta:
+ if not isinstance(month_delta, int):
raise ValueError('Month delta must be an integer')
month = (date.month - 1) + month_delta
year = date.year + month // 12
--
To view, visit https://gerrit.wikimedia.org/r/505630
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: Iff0679ff62dba9f51be604e55b0bc539fec6beaa
Gerrit-Change-Number: 505630
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
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/495172 )
Change subject: [bugfix] Remove test for 'id' in rcinfo.keys()
......................................................................
[bugfix] Remove test for 'id' in rcinfo.keys()
It is not safe that rcinfo contains this key
Bug: T217877
Change-Id: I7ac1830fb32b5557a5a455a3e322a23048052d0c
---
M tests/pagegenerators_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
D3r1ck01: Looks good to me, but someone else must approve
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 7440e6a..041ebcf 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1582,7 +1582,7 @@
self.assertEqual(rcinfo['server_name'], site.hostname())
self.assertEqual(rcinfo['wiki'], site.dbName())
- for key in ['id', 'type', 'namespace', 'title', 'comment',
+ for key in ['type', 'namespace', 'title', 'comment',
'timestamp', 'user', 'bot']:
self.assertIn(key, rcinfo.keys())
--
To view, visit https://gerrit.wikimedia.org/r/495172
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: I7ac1830fb32b5557a5a455a3e322a23048052d0c
Gerrit-Change-Number: 495172
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
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/505636 )
Change subject: [IMPR] Print the uri in error_handling_callback
......................................................................
[IMPR] Print the uri in error_handling_callback
- Print the called uri in error_handling_callback when the request
fails with an exception.
- remove print_function import which is not in this module
Change-Id: If5a7d8b3db1c442212367fcdb75fd2824826885f
---
M pywikibot/comms/http.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index fc1a990..fb11106 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -16,8 +16,7 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import (absolute_import, division,
- print_function, unicode_literals)
+from __future__ import absolute_import, division, unicode_literals
__docformat__ = 'epytext'
@@ -409,6 +408,7 @@
# if all else fails
if isinstance(request.data, Exception):
+ error('An error occurred for uri ' + request.uri)
raise request.data
if request.status == 504:
--
To view, visit https://gerrit.wikimedia.org/r/505636
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: If5a7d8b3db1c442212367fcdb75fd2824826885f
Gerrit-Change-Number: 505636
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)