Revision: 4412 Author: btongminh Date: 2007-10-03 19:23:37 +0000 (Wed, 03 Oct 2007)
Log Message: ----------- Completing the plugin stuff
Modified Paths: -------------- trunk/pywikipedia/commonsdelinker/delinker.py
Modified: trunk/pywikipedia/commonsdelinker/delinker.py =================================================================== --- trunk/pywikipedia/commonsdelinker/delinker.py 2007-10-03 19:23:15 UTC (rev 4411) +++ trunk/pywikipedia/commonsdelinker/delinker.py 2007-10-03 19:23:37 UTC (rev 4412) @@ -264,7 +264,7 @@ try: new_text = ImmutableByReference(new_text) m_summary = ImmutableByReference(summary) - if False is self.exec_hook('before_save', + if False is self.CommonsDelinker.exec_hook('before_save', (page, text, new_text, m_summary)): return 'skipped' @@ -322,7 +322,7 @@ self.lock = threading.Lock() self.CommonsDelinker = CommonsDelinker - def get(self, site, type, key = None): + def get(self, site, type, key = None, default = None): # This can probably also provide something for # localised settings, but then it first needs to # check whether the page is sysop only. @@ -362,6 +362,8 @@ # This will cause the bot to function even on special wikis # like mediawiki.org and meta and species. output(u'%s Using default summary for %s' % (self, site)) + + if default: return default if site.family.name != 'wikipedia' and self.CommonsDelinker.config['global']: if site.family.name in ('wiktionary', 'wikibooks', 'wikiquote', @@ -606,6 +608,7 @@ #else: # self.log_limit = '500' self.log_limit = '500' + self.init_plugins() def init_plugins(self): self.hooks = {} @@ -812,6 +815,10 @@ print >>sys.stderr, 'Currently unlogged:', unlogged threadpool.terminate() + @staticmethod + def output(*args): + return output(*args) + def output(message, toStdout = True): message = time.strftime('[%Y-%m-%d %H:%M:%S] ') + message wikipedia.output(message, toStdout = toStdout)