jenkins-bot has submitted this change and it was merged.
Change subject: use site methods instead of family methods ......................................................................
use site methods instead of family methods
- remove BaseSite.linktrail() which is already derived from Family.linktrail(code) by BaseSite.__getattr__() - port the doc string to the corresponding family method - remove BaseSite.nice_get_address() which is already derived from Family.nice_get_address(code) by BaseSite.__getattr__() - use methods version(), protocol(), hostname()
Change-Id: I33c9e6db6c2797bb7e637f3c46cb8af7f08037b8 --- M pywikibot/family.py M pywikibot/site.py 2 files changed, 13 insertions(+), 21 deletions(-)
Approvals: Ricordisamoa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py index b55a761..955e815 100644 --- a/pywikibot/family.py +++ b/pywikibot/family.py @@ -852,6 +852,16 @@ return self.known_families
def linktrail(self, code, fallback='_default'): + """Return regex for trailing chars displayed as part of a link. + + Returns a string, not a compiled regular expression object. + + This reads from the family file, and ''not'' from + [[MediaWiki:Linktrail]], because the MW software currently uses a + built-in linktrail from its message files and ignores the wiki + value. + + """ if code in self.linktrails: return self.linktrails[code] elif fallback: diff --git a/pywikibot/site.py b/pywikibot/site.py index 971edc5..62d6553 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -234,19 +234,6 @@ def __hash__(self): return hash(repr(self))
- def linktrail(self): - """Return regex for trailing chars displayed as part of a link. - - Returns a string, not a compiled regular expression object. - - This reads from the family file, and ''not'' from - [[MediaWiki:Linktrail]], because the MW software currently uses a - built-in linktrail from its message files and ignores the wiki - value. - - """ - return self.family.linktrail(self.code) - def languages(self): """Return list of all valid language codes for this site's Family."""
@@ -488,11 +475,6 @@
return pywikibot.Site(code=code, fam=self.family, user=self.user())
- def nice_get_address(self, title): - """Return shorter URL path to retrieve page titled 'title'.""" - - return self.family.nice_get_address(self.lang, title) - # deprecated methods for backwards-compatibility
@deprecated("family attribute") @@ -645,7 +627,7 @@ 14: [u"Category"], 15: [u"Category talk"], } - if LV(self.family.version(self.code)) >= LV("1.14"): + if LV(self.version()) >= LV("1.14"): self._namespaces[6] = [u"File"] self._namespaces[7] = [u"File talk"] self._msgcache = {} @@ -2858,8 +2840,8 @@ elif "url" in captcha: import webbrowser webbrowser.open('%s://%s%s' - % (self.family.protocol(self.code), - self.family.hostname(self.code), + % (self.protocol(), + self.hostname(), captcha["url"])) req['captchaword'] = cap_answerwikipedia.input( "Please view CAPTCHA in your browser, "
pywikibot-commits@lists.wikimedia.org