jenkins-bot has submitted this change and it was merged.
Change subject: (bug 62916) Only add hash if it is not None.
......................................................................
(bug 62916) Only add hash if it is not None.
A newly created Claim seems to have claim.hash=None now. This leads site.py
to add "hash" to the query and results in an API Error of previously working code.
Change-Id: I627ed24ed4e71abb560376b1ec2655852134285e
---
M pywikibot/site.py
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 78196a5..0d1e92d 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3865,7 +3865,9 @@
params['baserevid'] = claim.on_item.lastrevid
if bot:
params['bot'] = 1
- if not new and hasattr(qualifier, 'hash'):
+ if (not new and
+ hasattr(qualifier, 'hash') and
+ qualifier.hash is not None):
params['snakhash'] = qualifier.hash
params['token'] = self.token(claim, 'edit')
#build up the snak
--
To view, visit https://gerrit.wikimedia.org/r/119949
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I627ed24ed4e71abb560376b1ec2655852134285e
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: FelixReimann <felix(a)fex-it.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: (bug 62732) enable unique sysop names on all wikis with '*' language
......................................................................
(bug 62732) enable unique sysop names on all wikis with '*' language
This is similar with a common username for all sites of a family
using usernames['familyname']['*'], now for sysop account using
sysopnames['familyname']['*']
Change-Id: I1f65db94dd98b98946656632224fc135c3f75c21
---
M pywikibot/__init__.py
M pywikibot/config2.py
2 files changed, 9 insertions(+), 0 deletions(-)
Approvals:
Ricordisamoa: Looks good to me, but someone else must approve
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index b9edb35..b2c76f3 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -397,6 +397,11 @@
sysop = config.sysopnames[fam][code]
except KeyError:
sysop = None
+ if sysop is None:
+ try:
+ user = config.sysopnames[fam]['*']
+ except KeyError:
+ sysop = None
if interface is None:
interface = config.site_interface
try:
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index bf6c63f..3f6342c 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -49,6 +49,10 @@
#
# sysopnames['wikipedia']['de'] = 'myGermanUsername'
# sysopnames['wiktionary']['en'] = 'myEnglishUsername'
+#
+# If you have a unique syop account for all languages of a family,
+# you can use '*'
+# sysopnames['myownwiki']['*'] = 'mySingleUsername'
usernames = {}
sysopnames = {}
disambiguation_comment = {}
--
To view, visit https://gerrit.wikimedia.org/r/119059
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1f65db94dd98b98946656632224fc135c3f75c21
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: Ricordisamoa <ricordisamoa(a)live.it>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Revert "Make obsolete site object can be created"
......................................................................
Revert "Make obsolete site object can be created"
Breaks tests: https://travis-ci.org/wikimedia/pywikibot-core/builds/20728728
This reverts commit 70d384f3b526123909868d86828c31712500edd1.
Change-Id: I9e72cd6cf77065c0264ec6753d6c1ee9db1eec92
---
M pywikibot/page.py
M pywikibot/site.py
2 files changed, 15 insertions(+), 39 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 5c292f3..b75bbc3 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -991,40 +991,31 @@
# ignore any links with invalid contents
continue
- def langlinks(self, include_obsolete=False):
+ def langlinks(self):
"""Return a list of all interlanguage Links on this page.
-
- @param include_obsolete: if true, return even Link objects whose site
- is obsolete
"""
# Data might have been preloaded
if not hasattr(self, '_langlinks'):
- self._langlinks = list(self.iterlanglinks(include_obsolete=True))
+ self._langlinks = list(self.iterlanglinks())
- if include_obsolete:
- return self._langlinks
- else:
- return filter(lambda i: not i.site.obsolete, self._langlinks)
+ return self._langlinks
- def iterlanglinks(self, step=None, total=None, include_obsolete=False):
+ def iterlanglinks(self, step=None, total=None):
"""Iterate all interlanguage links on this page.
@param step: limit each API call to this number of pages
@param total: iterate no more than this number of pages in total
- @param include_obsolete: if true, yield even Link object whose site
- is obsolete
@return: a generator that yields Link objects.
"""
if hasattr(self, '_langlinks'):
- return iter(self.langlinks(include_obsolete=include_obsolete))
+ return iter(self._langlinks)
# XXX We might want to fill _langlinks when the Site
# method is called. If we do this, we'll have to think
# about what will happen if the generator is not completely
# iterated upon.
- return self.site.pagelanglinks(self, step=step, total=total,
- include_obsolete=include_obsolete)
+ return self.site.pagelanglinks(self, step=step, total=total)
def data_item(self):
"""
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 381d392..3d85c6b 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -129,15 +129,15 @@
else:
self.__family = fam
- self.obsolete = False
# if we got an outdated language code, use the new one instead.
if self.__code in self.__family.obsolete:
if self.__family.obsolete[self.__code] is not None:
self.__code = self.__family.obsolete[self.__code]
else:
# no such language anymore
- self.obsolete = True
- elif self.__code not in self.languages():
+ raise NoSuchSite("Language %s in family %s is obsolete"
+ % (self.__code, self.__family.name))
+ if self.__code not in self.languages():
if self.__family.name in list(self.__family.langs.keys()) and \
len(self.__family.langs) == 1:
oldcode = self.__code
@@ -707,15 +707,10 @@
@param right: the rights the logged in user should have
not supported yet and thus ignored.
@returns: a decorator to make sure the requirement is statisfied when
- the decorated function is called. The function can be called
- with as_group='sysop' to override the group set in the
- decorator.
+ the decorated function is called.
"""
def decorator(fn):
def callee(self, *args, **kwargs):
- if self.obsolete:
- raise NoSuchSite("Language %s in family %s is obsolete"
- % (self.code, self.family.name))
grp = kwargs.pop('as_group', group)
if grp == 'user':
self.login(False)
@@ -1964,14 +1959,8 @@
# No such function in the API (this method isn't called anywhere)
raise NotImplementedError
- def pagelanglinks(self, page, step=None, total=None,
- include_obsolete=False):
- """Iterate all interlanguage links on page, yielding Link objects.
-
- @param include_obsolete: if true, yield even Link objects whose
- site is obsolete
-
- """
+ def pagelanglinks(self, page, step=None, total=None):
+ """Iterate all interlanguage links on page, yielding Link objects."""
lltitle = page.title(withSection=False)
llquery = self._generator(api.PropertyGenerator,
type_arg="langlinks",
@@ -1985,13 +1974,9 @@
if 'langlinks' not in pageitem:
continue
for linkdata in pageitem['langlinks']:
- link = pywikibot.Link.langlinkUnsafe(linkdata['lang'],
- linkdata['*'],
- source=self)
- if link.site.obsolete and not include_obsolete:
- continue
- else:
- yield link
+ yield pywikibot.Link.langlinkUnsafe(linkdata['lang'],
+ linkdata['*'],
+ source=self)
def page_extlinks(self, page, step=None, total=None):
"""Iterate all external links on page, yielding URL strings."""
--
To view, visit https://gerrit.wikimedia.org/r/119277
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9e72cd6cf77065c0264ec6753d6c1ee9db1eec92
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>