jenkins-bot has submitted this change and it was merged.
Change subject: category.py: Replaced catlib except in move bot. ......................................................................
category.py: Replaced catlib except in move bot.
Removed catlib with other functions. Used easier syntax without Link class to create Category objects.
Change-Id: I5360fd4bebeb2d736fb5b86fc6d71a921acbebfb --- M scripts/category.py 1 file changed, 14 insertions(+), 14 deletions(-)
Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py index a72d33a..e009f86 100755 --- a/scripts/category.py +++ b/scripts/category.py @@ -500,7 +500,7 @@ self.overwrite = overwrite self.showImages = showImages self.site = pywikibot.getSite() - self.cat = catlib.Category(pywikibot.Link('Category:' + catTitle)) + self.cat = pywikibot.Category(self.site, catTitle) self.list = pywikibot.Page(self.site, listTitle) self.subCats = subCats self.talkPages = talkPages @@ -554,7 +554,7 @@ pagesonly=False): self.editSummary = editSummary self.site = pywikibot.getSite() - self.cat = catlib.Category(pywikibot.Link('Category:' + catTitle)) + self.cat = pywikibot.Category(self.site, catTitle) # get edit summary message self.useSummaryForDeletion = useSummaryForDeletion self.batchMode = batchMode @@ -574,9 +574,9 @@ for article in articles: if not self.titleRegex or re.search(self.titleRegex, article.title()): - catlib.change_category(article, self.cat, None, - comment=self.editSummary, - inPlace=self.inPlace) + article.change_category(self.cat, None, + comment=self.editSummary, + inPlace=self.inPlace) if self.pagesonly: return
@@ -587,9 +587,9 @@ % self.cat.title()) else: for subcategory in subcategories: - catlib.change_category(subcategory, self.cat, None, - comment=self.editSummary, - inPlace=self.inPlace) + subcategory.change_category(self.cat, None, + comment=self.editSummary, + inPlace=self.inPlace) # Deletes the category page if self.cat.exists() and self.cat.isEmptyCategory(): if self.useSummaryForDeletion and self.editSummary: @@ -708,8 +708,8 @@ if current_cat == original_cat: pywikibot.output('No changes necessary.') else: - catlib.change_category(article, original_cat, current_cat, - comment=self.editSummary) + article.change_category(original_cat, current_cat, + comment=self.editSummary) flag = True elif choice in ['j', 'J']: newCatTitle = pywikibot.input(u'Please enter the category the ' @@ -721,8 +721,8 @@ flag = True elif choice in ['r', 'R']: # remove the category tag - catlib.change_category(article, original_cat, None, - comment=self.editSummary) + article.change_category(original_cat, None, + comment=self.editSummary) flag = True elif choice == '?': contextLength += 500 @@ -755,7 +755,7 @@ flag = True
def run(self): - cat = catlib.Category(pywikibot.Link('Category:' + self.catTitle)) + cat = pywikibot.Category(self.site, self.catTitle)
articles = set(cat.articles()) if len(articles) == 0: @@ -847,7 +847,7 @@ * maxDepth - the limit beyond which no subcategories will be listed
""" - cat = catlib.Category(pywikibot.Link('Category:' + self.catTitle)) + cat = pywikibot.Category(self.site, catTitle) tree = self.treeview(cat) if self.filename: pywikibot.output(u'Saving results in %s' % self.filename)
pywikibot-commits@lists.wikimedia.org