Normalize article titles with anchors
In our db article titles with anchors are stored with underscores in anchor string. Therefore we need to replace spaces in anchor string given by pywikibot.Page.title(). Related Task: [FS#151](https://fs.golderweb.de/index.php?do=details&task_id=151)
This commit is contained in:
@@ -186,25 +186,32 @@ class MarkPagesBot( CurrentPageBot ): # sets 'current_page' on each treat()
|
||||
# None if change was not accepted by user
|
||||
save_ret = self.put_current( self.new_text, summary=summary )
|
||||
|
||||
# Normalize title with anchor (replace spaces in anchor)
|
||||
article = self.current_page.title(withNamespace=False)
|
||||
article_parts = article.split("#", 1)
|
||||
if len(article_parts) == 2:
|
||||
article_parts[1] = article_parts[1].replace(" ", "_")
|
||||
article = "#".join(article_parts)
|
||||
|
||||
# Status
|
||||
if add_ret is None or ( add_ret and save_ret ):
|
||||
self.current_page.redfam.article_remove_status(
|
||||
"note_rej",
|
||||
title=self.current_page.title(withNamespace=False))
|
||||
title=article)
|
||||
self.current_page.redfam.article_remove_status(
|
||||
"sav_err",
|
||||
title=self.current_page.title(withNamespace=False))
|
||||
title=article)
|
||||
self.current_page.redfam.article_add_status(
|
||||
"marked",
|
||||
title=self.current_page.title(withNamespace=False))
|
||||
title=article)
|
||||
elif save_ret is None:
|
||||
self.current_page.redfam.article_add_status(
|
||||
"note_rej",
|
||||
title=self.current_page.title(withNamespace=False))
|
||||
title=article)
|
||||
else:
|
||||
self.current_page.redfam.article_add_status(
|
||||
"sav_err",
|
||||
title=self.current_page.title(withNamespace=False))
|
||||
title=article)
|
||||
|
||||
def add_disc_notice_template( self ):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user