Welcome to the ScoutWiki Network

Bot configuration/yeargene.py

From ScoutWiki Network
Jump to: navigation, search

If you copy the code from the source, make sure you remove all the <nowiki> tags before using !

Texts are in French, for help ask Akela -Haooww ! - Or just look by yourself how those pages work on PartioWiki and Scoutopedia.

#!/usr/bin/python
# -*- coding: utf-8  -*-

__version__='$Id: dategene.py,v 1.0 2006/04/4 19:26:01 wikipedian Exp $'

import wikipedia
import login

msg = {
         'en':u'Robot: Year page created',
         'fr':u"Bot: cr\u00e9ation de la page d'ann\u00e9e."
       }

comment = wikipedia.translate(wikipedia.getSite(), msg)
wikipedia.setAction(comment)

s=wikipedia.getSite()
for pa in range(1907,2020):
      pp=pa
      p=wikipedia.Page(s,str(pp))
      st=u"<!--Lister les \u00e9v\u00e8nements par ordre chronologique, en pr\u00e9cisant la date. Pour les \u00e9v\u00e8nements dont la date n'est pas connue, les lister en dessous.-->"
      st+=u'\n'
      st+=u'{{navigation dates|hier='+str(pp-1)+'|demain='+str(pp+1)+'}}\n'
      st+=u'\n'
      st+=u'{{portail histoire}}'
      st+=u'\n'
      st+=u'[[Cat\u00e9gorie:Chronologie du scoutisme]]\n'
      st+=u'[[nl:'+str(pp)+']]\n'
      st+=u'[[fi:'+str(pp)+']]\n'
      st+=u'\n'
      p.put(st)
wikipedia.stopme()