jenkins-bot has submitted this change and it was merged.
Change subject: Corrected site defined for TestDataIngestionBot
......................................................................
Corrected site defined for TestDataIngestionBot
Change-Id: I7358406596d5d51aa79cd74047140826d4a3d3ab
---
M tests/data_ingestion_tests.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/data_ingestion_tests.py b/tests/data_ingestion_tests.py
index 8a26978..0b195fa 100644
--- a/tests/data_ingestion_tests.py
+++ b/tests/data_ingestion_tests.py
@@ -99,13 +99,13 @@
"""Test TestDataIngestionBot class."""
- family = 'commons'
- code = 'commons'
+ family = 'test'
+ code = 'test'
def test_existing_file(self):
"""Test uploading a file that already exists."""
data_ingestion.main(
- '-family:test', '-lang:test', '-csvdir:tests/data',
+ '-csvdir:tests/data',
'-page:User:John_Vandenberg/data_ingestion_test_template')
--
To view, visit https://gerrit.wikimedia.org/r/206051
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7358406596d5d51aa79cd74047140826d4a3d3ab
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Fix Site loading without an explicit family
......................................................................
Fix Site loading without an explicit family
Change-Id: Ia6696de8f7718e1e48b6186035349c786459495b
---
M pywikibot/textlib.py
M scripts/interwiki.py
2 files changed, 12 insertions(+), 7 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Ricordisamoa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 530dc70..f7a8da6 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -624,11 +624,15 @@
def interwikiFormat(links, insite=None):
"""Convert interwiki link dict into a wikitext string.
- 'links' should be a dict with the Site objects as keys, and Page
- or Link objects as values.
-
- Return a unicode string that is formatted for inclusion in insite
- (defaulting to the current site).
+ @param links: interwiki links to be formatted
+ @type links: dict with the Site objects as keys, and Page
+ or Link objects as values.
+ @param insite: site the interwiki links will be formatted for
+ (defaulting to the current site).
+ @type insite: BaseSite
+ @return: string including wiki links formatted for inclusion
+ in insite
+ @rtype: unicode
"""
if insite is None:
insite = pywikibot.Site()
@@ -644,7 +648,8 @@
link = title.replace('[[:', '[[')
s.append(link)
except AttributeError:
- s.append(pywikibot.Site(code=site).linkto(links[site], othersite=insite))
+ s.append(pywikibot.Site(site, insite.family).linkto(
+ links[site], othersite=insite))
if insite.lang in insite.family.interwiki_on_one_line:
sep = u' '
else:
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 396a085..cafbbbc 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1680,7 +1680,7 @@
frgnSiteDone = False
for siteCode in lclSite.family.languages_by_size:
- site = pywikibot.Site(siteCode)
+ site = pywikibot.Site(siteCode, lclSite.family)
if (not lclSiteDone and site == lclSite) or \
(not frgnSiteDone and site != lclSite and site in new):
if site == lclSite:
--
To view, visit https://gerrit.wikimedia.org/r/205991
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6696de8f7718e1e48b6186035349c786459495b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Deprecate APISite.checkBlocks
......................................................................
Deprecate APISite.checkBlocks
The 'checkBlocks' method is unused, and 'is blocked' is nearly always
wrong and should be replaced with permission checking using 'has_right'.
Also, use redirect_func to provide the already deprecated methods
'isBlocked' and 'isAllowed'.
Change-Id: Iafc023d3bda1d1012d1d453ff2e990f34eebe333
---
M pywikibot/site.py
1 file changed, 24 insertions(+), 13 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 5848169..8b60c0e 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -1745,22 +1745,29 @@
globaluserinfo = property(fget=getglobaluserinfo, doc=getuserinfo.__doc__)
def is_blocked(self, sysop=False):
- """Return true if and only if user is blocked.
+ """
+ Return True when logged in user is blocked.
+
+ To check whether a user can perform an action,
+ the method has_right should be used.
@param sysop: If true, log in to sysop account (if available)
-
+ @type sysop: bool
+ @rtype: bool
"""
if not self.logged_in(sysop):
self.login(sysop)
return 'blockinfo' in self._userinfo
- @deprecated('is_blocked()')
- def isBlocked(self, sysop=False):
- """DEPRECATED."""
- return self.is_blocked(sysop)
-
+ @deprecated('has_right() or is_blocked()')
def checkBlocks(self, sysop=False):
- """Check if the user is blocked, and raise an exception if so."""
+ """
+ Raise an exception when the user is blocked. DEPRECATED.
+
+ @param sysop: If true, log in to sysop account (if available)
+ @type sysop: bool
+ @raises UserBlocked: The logged in user/sysop account is blocked.
+ """
if self.is_blocked(sysop):
# User blocked
raise UserBlocked('User is blocked in site %s' % self)
@@ -1823,11 +1830,6 @@
if not self.logged_in(sysop):
self.login(sysop)
return right.lower() in self._userinfo['rights']
-
- @deprecated("Site.has_right()")
- def isAllowed(self, right, sysop=False):
- """DEPRECATED."""
- return self.has_right(right, sysop)
def has_group(self, group, sysop=False):
"""Return true if and only if the user is a member of specified group.
@@ -5392,6 +5394,12 @@
comparison = data['compare']['*']
return comparison
+ # aliases for backwards compatibility
+ isBlocked = redirect_func(is_blocked, old_name='isBlocked',
+ class_name='APISite')
+ isAllowed = redirect_func(has_right, old_name='isAllowed',
+ class_name='APISite')
+
class DataSite(APISite):
@@ -5937,6 +5945,9 @@
def isBlocked(self, *args, **kwargs):
raise NotImplementedError
+ def checkBlocks(self, *args, **kwargs):
+ raise NotImplementedError
+
def isAllowed(self, *args, **kwargs):
raise NotImplementedError
--
To view, visit https://gerrit.wikimedia.org/r/180719
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iafc023d3bda1d1012d1d453ff2e990f34eebe333
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Remove __main__ handler
......................................................................
Remove __main__ handler
This is the only module within pywikibot that contains a main
that prints the module docstring, and in this case it is almost
useless now being only 'Date data and manipulation module.' It used
to be:
This file is not runnable, but it only consists of various
lists which are required by some other programs.
Change-Id: I43bcea448cd6b6d1591bd288e5aa6b3205914b4f
---
M pywikibot/date.py
1 file changed, 0 insertions(+), 4 deletions(-)
Approvals:
Ricordisamoa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/date.py b/pywikibot/date.py
index 75fdc9d..262e786 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -2413,7 +2413,3 @@
are consecutive and non-negative numbers.
"""
return date2.month - date1.month + (date2.year - date1.year) * 12
-
-
-if __name__ == "__main__":
- print(__doc__)
--
To view, visit https://gerrit.wikimedia.org/r/205831
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I43bcea448cd6b6d1591bd288e5aa6b3205914b4f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: jenkins-bot <>