Add method to generate notice for article discpage

We need a method to generate the template to add to article discpages

Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=29 FS#29]
This commit is contained in:
2016-08-27 00:07:28 +02:00
parent 8acba7d0f9
commit 6717fa4fba

View File

@@ -487,6 +487,50 @@ class RedFamWorker( RedFam ):
return ( self.redpagetitle + "#" +
str(anchor_code).strip() )
def generate_disc_notice_template( self ):
"""
Generates notice template to add on discussion Pages of Articles when
redundancy discussion is finished
@return Notice template to add on article disc
@rtype wikicode-node
"""
# Generate template boilerplate
template = mwparser.nodes.template.Template(
jogobot.config['redundances']['disc_notice_template_name'])
# Index of first article's param
param_cnt = 3
# Iterate over articles in redfam
for article in self._articlesList:
# Make sure to only use 8 articles (max. param 10)
if param_cnt > 10:
break
# Add param for article
template.add( param_cnt, article, True )
param_cnt += 1
# Add begin
template.add( "Beginn", self._mysql.data[ 'beginning' ].strftime(
"%d. %B %Y").lstrip("0"), True )
# Add end
template.add( "Ende", self._mysql.data[ 'ending' ].strftime(
"%d. %B %Y").lstrip("0"), True )
# Add link to related reddisc
template.add( "Diskussion", self.get_disc_link(), True )
# Add signature and timestamp
# Not used atm
# template.add( 1, "-- ~~~~", True )
return template
@classmethod
def list_by_status( cls, status ):
"""