[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pywikipediabot-users
Subject:    [pyWikipediaBot-users] pywikipedia category.py,1.107,1.108
From:       Cyde Weys <cydeweys () users ! sourceforge ! net>
Date:       2006-05-31 2:35:19
Message-ID: E1FlGYK-0004ok-G4 () mail ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/pywikipediabot/pywikipedia
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17153

Modified Files:
	category.py 
Log Message:
Fixing batch mode and adding functionality to automatically remove CFD
templates from category page source before copying over.
NOTE: This will require 1.69 or newer of catlib.py.



Index: category.py
===================================================================
RCS file: /cvsroot/pywikipediabot/pywikipedia/category.py,v
retrieving revision 1.107
retrieving revision 1.108
diff -C2 -d -r1.107 -r1.108
*** category.py	30 Apr 2006 18:38:49 -0000	1.107
--- category.py	31 May 2006 02:35:16 -0000	1.108
***************
*** 21,26 ****
           NOTE: If the category names have spaces in them, surround the names with
           single quotes, i.e. -to:Us -from:'United States'
!  * -batch     - Don't prompt to delete categories.  Also good to use if your bot
!                doesn't have administrator access.
   * -summary:  - Pick a custom edit summary for the bot.
  
--- 21,25 ----
           NOTE: If the category names have spaces in them, surround the names with
           single quotes, i.e. -to:Us -from:'United States'
!  * -batch     - Don't prompt to delete emptied categories (do it automatically).
   * -summary:  - Pick a custom edit summary for the bot.
  
***************
*** 95,98 ****
--- 94,101 ----
      }
  
+ cfd_templates = {
+     'en':['cfd', 'cfr', 'cfru', 'cfr-speedy', 'cfm', 'cfdu'],
+     }
+ 
  class CategoryDatabase:
      '''
***************
*** 312,322 ****
          if self.oldCat.exists():
              # try to copy page contents to new cat page
!             if self.oldCat.copyTo(newCatTitle):
! 		if batchMode == False:
!                     if self.oldCat.isEmpty():
!                         reason = wikipedia.translate(wikipedia.getSite(), \
                deletion_reason_move) % newCatTitle
!                         self.oldCat.delete(reason)
                      else:
!                         wikipedia.output('Couldn\'t copy contents of %s because %s \
already exists.' % (self.oldCatTitle, self.newCatTitle))  
  class CategoryRemoveRobot:
--- 315,327 ----
          if self.oldCat.exists():
              # try to copy page contents to new cat page
!             if self.oldCat.copyAndKeep(newCatTitle, \
                wikipedia.translate(wikipedia.getSite(), cfd_templates)):
!                 if self.oldCat.isEmpty():
!                     reason = wikipedia.translate(wikipedia.getSite(), \
                deletion_reason_move) % newCatTitle
!                     if batchMode == True:
!                         self.oldCat.delete(reason, False)
                      else:
!                         self.oldCat.delete(reason, True)
!                 else:
!                     wikipedia.output('Couldn\'t copy contents of %s because %s \
already exists.' % (self.oldCatTitle, self.newCatTitle))  
  class CategoryRemoveRobot:
***************
*** 368,374 ****
              for subcategory in subcategories:
                  catlib.change_category(subcategory, self.cat.title(), None)
!         if self.cat.exists() and self.cat.isEmpty() and batchMode == False:
              reason = wikipedia.translate(wikipedia.getSite(), \
                self.deletion_reason_remove)
!             self.cat.delete(reason)
  
  class CategoryTidyRobot:
--- 373,382 ----
              for subcategory in subcategories:
                  catlib.change_category(subcategory, self.cat.title(), None)
!         if self.cat.exists() and self.cat.isEmpty():
              reason = wikipedia.translate(wikipedia.getSite(), \
                self.deletion_reason_remove)
!             if batchMode == True:
!                 self.cat.delete(reason, False)
!             else:
!                 self.cat.delete(reason, True)
  
  class CategoryTidyRobot:



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
pyWikipediaBot-users mailing list
pyWikipediaBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pywikipediabot-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic