jenkins-bot merged this change.
[i18n] Enable twn for i18n messages in create_categories.py
Bug: T220260
Change-Id: Ibafbc8a149f3b693e6d25e6e3ff9804ded6f9e22
---
M scripts/create_categories.py
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/scripts/create_categories.py b/scripts/create_categories.py
index 3818bd0..d902de8 100755
--- a/scripts/create_categories.py
+++ b/scripts/create_categories.py
@@ -41,13 +41,16 @@
from __future__ import absolute_import, division, unicode_literals
import pywikibot
-from pywikibot import pagegenerators, Bot
+from pywikibot.bot import AutomaticTWSummaryBot, SingleSiteBot
+from pywikibot import pagegenerators
-class CreateCategoriesBot(Bot):
+class CreateCategoriesBot(SingleSiteBot, AutomaticTWSummaryBot):
"""Category creator bot."""
+ summary_key = 'create_categories-create'
+
def __init__(self, generator, parent, basename, overwrite, **kwargs):
"""Initializer."""
super(CreateCategoriesBot, self).__init__(**kwargs)
@@ -55,7 +58,6 @@
self.parent = parent
self.basename = basename
self.overwrite = overwrite
- self.comment = 'Creating new category'
def treat(self, page):
"""Create category in commons for that page."""
@@ -67,10 +69,9 @@
'[[Category:%(title)s]]\n'
% {'parent': self.parent, 'title': title})
- pywikibot.output(newpage.title())
- self.userPut(newpage, '', newtext, summary=self.comment,
- ignore_save_related_errors=True,
- ignore_server_errors=True)
+ self.current_page = newpage
+ self.current_page.text = ''
+ self.put_current(newtext, ignore_server_errors=True)
def skip_page(self, page):
"""Skip page if it is not overwritten."""
To view, visit change 502165. To unsubscribe, or for help writing mail filters, visit settings.