[Pywikipedia-l] SVN: [5339] trunk/pywikipedia/noreferences.py

wikipedian at svn.wikimedia.org wikipedian at svn.wikimedia.org
Thu May 8 19:37:31 UTC 2008


Revision: 5339
Author:   wikipedian
Date:     2008-05-08 19:37:31 +0000 (Thu, 08 May 2008)

Log Message:
-----------
rolled back more of the changes from the update of Betacommand / siebrand, revision 4985:
* Putting pages asynchronously in always-yes mode is not useful. The asynchronous putting 
feature is meant to reduce waiting times in interactive mode.
* Removed the stop-on-new-messages feature. This is really annoying, most bot operators don't 
read their messages with their bot accounts. Also, it doesn't belong here. If you want such a 
feature, add code to wikipedia.py which stops the bot on new messages. Use a config variable for 
this, and set its default so that the bot continues when there are new messages.

Modified Paths:
--------------
    trunk/pywikipedia/noreferences.py

Modified: trunk/pywikipedia/noreferences.py
===================================================================
--- trunk/pywikipedia/noreferences.py	2008-05-08 19:17:04 UTC (rev 5338)
+++ trunk/pywikipedia/noreferences.py	2008-05-08 19:37:31 UTC (rev 5339)
@@ -21,7 +21,6 @@
                    -start:Category:M.
 
     -always        Don't prompt you for each replacement.
-    -ignoremsg     Don't stop when the bot has new messages
 
 All other parameters will be regarded as part of the title of a single page,
 and the bot will only work on that single page.
@@ -211,10 +210,9 @@
 
 class NoReferencesBot:
 
-    def __init__(self, generator, always = False, ignoreMsg = False):
+    def __init__(self, generator, always = False):
         self.generator = generator
         self.always = always
-        self.ignoreMsg = ignoreMsg
         self.site = wikipedia.getSite()
         self.refR = re.compile('</ref>', re.IGNORECASE)
         self.referencesR = re.compile('<references */>', re.IGNORECASE)
@@ -335,10 +333,7 @@
 
         if self.always:
             try:
-                page.put_async(newText)
-                if self.site.messages() and not self.ignoreMsg:
-                    wikipedia.output(u'NOTE: You have unread messages, stopping...')
-                    wikipedia.stopme()
+                page.put(newText)
             except wikipedia.EditConflict:
                 wikipedia.output(u'Skipping %s because of edit conflict' % (page.title(),))
             except wikipedia.SpamfilterError, e:
@@ -348,9 +343,6 @@
         else:
             # Save the page in the background. No need to catch exceptions.
             page.put_async(newText)
-        if self.site.messages() and not self.ignoreMsg:
-          wikipedia.output(u'NOTE: You have unread messages, stopping...')
-          wikipedia.stopme()
         return
 
     def run(self):
@@ -375,9 +367,6 @@
             if self.lacksReferences(text):
                 newText = self.addReferences(text)
                 self.save(page, newText)
-                if self.site.messages() and not self.ignoreMsg:
-                  wikipedia.output(u'NOTE: You have unread messages, stopping...')
-                  wikipedia.stopme()
 
 def main():
     #page generator
@@ -390,8 +379,6 @@
     namespaces = []
     # Never ask before changing a page
     always = False
-    # Stop when the bot has new messages
-    ignoreMsg = False
     # This factory is responsible for processing command line arguments
     # that are also used by other scripts and that determine on which pages
     # to work on.
@@ -411,8 +398,6 @@
                 namespaces.append(arg[11:])
         elif arg == '-always':
             always = True
-        elif arg == '-ignoremsg':
-            ignoreMsg = True
         else:
             generator = genFactory.handleArg(arg)
             if generator:
@@ -429,7 +414,7 @@
         if namespaces != []:
             gen =  pagegenerators.NamespaceFilterPageGenerator(gen, namespaces)
         preloadingGen = pagegenerators.PreloadingGenerator(gen)
-        bot = NoReferencesBot(preloadingGen, always, ignoreMsg)
+        bot = NoReferencesBot(preloadingGen, always)
         bot.run()
 
 if __name__ == "__main__":





More information about the Pywikipedia-l mailing list