Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/221112

Change subject: Remove has_valid_template() test
......................................................................

Remove has_valid_template() test

Because l10n_tests.py is validating L10N templates,
this additional test is superfluous.

Change-Id: I1828360ce7520b6ac7e8c1a977890cdf8110117b
---
M scripts/redirect.py
1 file changed, 2 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/12/221112/1

diff --git a/scripts/redirect.py b/scripts/redirect.py
index ec99198..f5cb931 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -379,27 +379,6 @@
         self.action = action
         self.generator = generator
         self.exiting = False
-        self._valid_template = None
-
-    def has_valid_template(self, twtitle):
-        """
-        Check whether a template from translatewiki.net exists on the wiki.
-
-        We assume we are always working on self.site
-
-        @param twtitle - a string which is the i18n key
-
-        """
-        if self._valid_template is None:
-            self._valid_template = False
-            if i18n.twhas_key(self.site, twtitle):
-                template_msg = i18n.twtranslate(self.site, twtitle)
-                template = re.findall(u'.*?{{(.*?)[|}]', template_msg)
-                if template:
-                    title = template[0]
-                    page = pywikibot.Page(self.site, title, ns=10)
-                    self._valid_template = page.exists()
-        return self._valid_template
 
     def delete_broken_redirects(self):
         # get reason for deletion text
@@ -487,8 +466,8 @@
                         assert targetPage.site == self.site, (
                             u'target page is on different site %s'
                             % targetPage.site)
-                        if self.has_valid_template(
-                                'redirect-broken-redirect-template'):
+                        if i18n.twhas_key(self.site,
+                                          'redirect-broken-redirect-template'):
                             pywikibot.output(u"No sysop in user-config.py, "
                                              u"put page to speedy deletion.")
                             content = redir_page.get(get_redirect=True)

-- 
To view, visit https://gerrit.wikimedia.org/r/221112
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1828360ce7520b6ac7e8c1a977890cdf8110117b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to