Revision: 4434 Author: cosoleto Date: 2007-10-09 14:07:59 +0000 (Tue, 09 Oct 2007)
Log Message: ----------- bugfix
Modified Paths: -------------- trunk/pywikipedia/copyright_put.py
Modified: trunk/pywikipedia/copyright_put.py =================================================================== --- trunk/pywikipedia/copyright_put.py 2007-10-09 14:06:41 UTC (rev 4433) +++ trunk/pywikipedia/copyright_put.py 2007-10-09 14:07:59 UTC (rev 4434) @@ -51,10 +51,10 @@
separatorC = re.compile('(?m)^== +')
-def set_template(): +def set_template(name = None):
site = wikipedia.getSite() - url = "%s://%s%s" % (site.protocol, site.hostname(), site.path()) + url = "%s://%s%s" % (site.protocol(), site.hostname(), site.path())
botdate = u""" <div style="text-align:right">{{{1}}}</div><noinclude>%s\n[[%s:%s]]</noinclude> @@ -64,11 +64,16 @@ <div class=plainlinks style="text-align:right">[%s?title={{{1}}}&diff={{{2}}}&oldid={{{3}}} diff] - [%s?title={{{1}}}&action=history cron] - [%s?title=Special:Log&page={{{1}}} log]</div><noinclude>%s\n[[%s:%s]]</noinclude> """ % (url, url, url, template_cat[0], site.namespace(14), template_cat[1])
- if append_date_to_entries: + if name == 'botdate': p = wikipedia.Page(site, 'Template:botdate') if not p.exists(): - p.put(botdate) + p.put(botdate, comment = 'Init.')
+ if name == 'botbox': + p = wikipedia.Page(site, 'Template:botbox') + if not p.exists(): + p.put(botbox, comment = 'Init.') + def stat_sum(engine, text): return len(re.findall('(?im)^*.*?' + engine + '.*?- ', text))
@@ -222,6 +227,11 @@ except wikipedia.PageNotSaved: raise
+ if append_date_to_entries: + set_template(name = 'botdate') + if '{{botbox' in wikitext: + set_template(name = 'botbox') + if send_stats: put_stats()