Catch sections with more then 8 articles
This commit is contained in:
@@ -6,6 +6,8 @@ import re
|
|||||||
import locale
|
import locale
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
import pywikibot
|
||||||
|
|
||||||
from mysql_red import MYSQL_RED_FAM
|
from mysql_red import MYSQL_RED_FAM
|
||||||
|
|
||||||
class RED_FAM:
|
class RED_FAM:
|
||||||
@@ -96,6 +98,8 @@ class RED_FAM_PARSER( RED_FAM ):
|
|||||||
#If no ending was provided set to None
|
#If no ending was provided set to None
|
||||||
self._ending = None
|
self._ending = None
|
||||||
|
|
||||||
|
self._status = None
|
||||||
|
|
||||||
# Parse the provided heading of redundance section to set self._articlesList
|
# Parse the provided heading of redundance section to set self._articlesList
|
||||||
self.heading_parser( heading )
|
self.heading_parser( heading )
|
||||||
|
|
||||||
@@ -139,6 +143,11 @@ class RED_FAM_PARSER( RED_FAM ):
|
|||||||
# We get the pages in first [0] element iterating over wikilink_pat.findall( line )
|
# We get the pages in first [0] element iterating over wikilink_pat.findall( line )
|
||||||
self._articlesList = [ link[0] for link in wikilink_pat.findall( self._heading ) ]
|
self._articlesList = [ link[0] for link in wikilink_pat.findall( self._heading ) ]
|
||||||
|
|
||||||
|
# Catch sections with more then 8 articles, print error
|
||||||
|
if len( self._articlesList ) > 8:
|
||||||
|
pywikibot.output( "{datetime} – \03{{lightred}}[WARNING] – Maximum number of articles in red_fam exceeded, maximum number is 8, {number:d} were given\n{repress}".format( datetime=datetime.now().strftime("%Y-%m-%d %H:%M:%S (%Z)"), number=len( self._articlesList ), repress=repr( self ) ) )
|
||||||
|
self._articlesList = self._articlesList[:8]
|
||||||
|
|
||||||
def fam_hash( self ):
|
def fam_hash( self ):
|
||||||
"""
|
"""
|
||||||
Calculates the SHA-1 hash for the articlesList of redundance family.
|
Calculates the SHA-1 hash for the articlesList of redundance family.
|
||||||
|
|||||||
Reference in New Issue
Block a user