Revision: 6236
Author: multichill
Date: 2009-01-09 19:04:37 +0000 (Fri, 09 Jan 2009)
Log Message:
-----------
Removed the use of wikipedia.setAction() in CategoryMoveRobot. Still have to remove it from the other bots.
Modified Paths:
--------------
trunk/pywikipedia/category.py
Modified: trunk/pywikipedia/category.py
===================================================================
--- trunk/pywikipedia/category.py 2009-01-09 15:37:41 UTC (rev 6235)
+++ trunk/pywikipedia/category.py 2009-01-09 19:04:37 UTC (rev 6236)
@@ -403,11 +403,8 @@
self.deleteEmptySourceCat = deleteEmptySourceCat
self.titleRegex = titleRegex
# set edit summary message
- if self.editSummary:
- wikipedia.setAction(self.editSummary)
- else:
- wikipedia.setAction(wikipedia.translate(site, msg_change)
- % self.oldCat.title())
+ if not self.editSummary:
+ self.editSummary = wikipedia.translate(site, msg_change)% self.oldCat.title()
def run(self):
site = wikipedia.getSite()
@@ -446,7 +443,7 @@
if not self.titleRegex or re.search(self.titleRegex,
article.title()):
catlib.change_category(article, self.oldCat, newCat,
- inPlace=self.inPlace)
+ comment=self.editSummary, inPlace=self.inPlace)
# Move subcategories
gen = pagegenerators.SubCategoriesPageGenerator(self.oldCat,
@@ -456,7 +453,7 @@
if not self.titleRegex or re.search(self.titleRegex,
subcategory.title()):
catlib.change_category(subcategory, self.oldCat, newCat,
- inPlace=self.inPlace)
+ comment=self.editSummary, inPlace=self.inPlace)
# Delete the old category and its moved talk page
if copied and self.deleteEmptySourceCat == True:
Revision: 6235
Author: filnik
Date: 2009-01-09 15:37:41 +0000 (Fri, 09 Jan 2009)
Log Message:
-----------
Little bugfix.. use the APIs instead of the normal HTML source..
Modified Paths:
--------------
trunk/pywikipedia/welcome.py
Modified: trunk/pywikipedia/welcome.py
===================================================================
--- trunk/pywikipedia/welcome.py 2009-01-09 15:37:14 UTC (rev 6234)
+++ trunk/pywikipedia/welcome.py 2009-01-09 15:37:41 UTC (rev 6235)
@@ -159,7 +159,7 @@
add them directly in the source code that you are using without adding or deleting.
Some words, like "Administrator" or "Dio" (God in italian) or "Jimbo" aren't badword at all
-but can be used to some bad-nickname.
+but can be used for some bad-nickname.
"""
#
# (C) Alfio, 2005
Revision: 6234
Author: filnik
Date: 2009-01-09 15:37:14 +0000 (Fri, 09 Jan 2009)
Log Message:
-----------
Little bugfix.. use the APIs instead of the normal HTML source..
Modified Paths:
--------------
trunk/pywikipedia/welcome.py
Modified: trunk/pywikipedia/welcome.py
===================================================================
--- trunk/pywikipedia/welcome.py 2009-01-09 14:47:10 UTC (rev 6233)
+++ trunk/pywikipedia/welcome.py 2009-01-09 15:37:14 UTC (rev 6234)
@@ -147,7 +147,7 @@
* The regex to load the user might be slightly different from project to project.
(in this case, write to Filnik for help...)
-* Understand if it's the case to use a class to group toghether the functions used.
+* Use a class to group toghether the functions used.
******************************** Badwords ***********************************
@@ -173,7 +173,7 @@
__version__ = '$Id: welcome.py,v 1.5 2007/12/7 19.23.00 filnik Exp$'
#
-import wikipedia, config, string, locale
+import wikipedia, config, string, locale, query
import time, re, cPickle, os, urllib
import codecs, sys
from datetime import timedelta
@@ -485,22 +485,28 @@
pos = y.end()
wikipedia.output(u'%s is already in the report page.' % username)
-def blocked(wsite, username):
- """ The function to understand if the user is blocked or not. """
- pathWiki = wsite.family.nicepath(wsite.lang)
- #A little function to check if the user has already been blocked (to skip him).
- reg = r"""<li>\d\d:\d\d, \d(\d)? (.*?) \d\d\d\d <a href=\"""" + re.escape(pathWiki) + \
- r"""(.*?)\" title=\"(.*?)\">(.*?)</a> <span class=\"mw-usertoollinks\">"""
- block_text = wsite.getUrl(wsite.path() + '?title=Special:Log/block&page=User:' + username)
- numblock = re.findall(reg, block_text)
- # If the bot doesn't find block-line (that means the user isn't blocked), it will return False otherwise True.
- if len(numblock) == 0:
- # No problem.
- return False
- else:
- # User Blocked.
- return True
+def blocked(username):
+ #action=query&list=users&ususers=Filnik&usprop=blockinfo
+ """
+ Function that detects if a user is currently blocked or not.
+ """
+
+ params = {
+ 'action' :'query',
+ 'list' :'users',
+ 'ususers' :username,
+ 'usprop' :'blockinfo',
+ }
+ data = query.GetData(params,
+ useAPI = True, encodeTitle = False)
+ # If there's not the blockedby parameter (that means the user isn't blocked), it will return False otherwise True.
+ try:
+ blockedBy = data['query']['users'][0]['blockedby']
+ except KeyError:
+ return False # No he's not
+ return True # Yes is blocked
+
def defineSign(wsite, signPageTitle, fileSignName = None, fileOption = False):
""" Function to load the random signatures. """
reg = r"^\* ?(.*?)$"
@@ -844,7 +850,7 @@
# OK, no problem
pass
# Check if the user has been already blocked.
- ki = blocked(wsite,username)
+ ki = blocked(username)
if ki == True:
wikipedia.output(u'%s has been blocked! Skipping...' % usertalkpage.titleWithoutNamespace())
continue
@@ -882,7 +888,7 @@
if answer.lower() in ['yes', 'y']:
if not usertalkpage.exists():
# Check if the user has been already blocked (second check).
- if blocked(wsite, username):
+ if blocked(username):
wikipedia.output(u'%s has been blocked! Skipping him...' % usertalkpage.titleWithoutNamespace())
report(wsite, rep_page, username, com, final_rep)
continue
Feature Requests item #1722782, was opened at 2007-05-21 11:21
Message generated for change (Comment added) made by russblau
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1722782&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Byrial Ole Jensen (byrial)
Assigned to: Nobody/Anonymous (nobody)
Summary: interwiki.py should follow category redirect templates
Initial Comment:
Sometimes when a category is moved, a template like [[en:template:Template:Category redirect]] (see its interwiki links for similar templates in other languages) is left at the old category page.
It would be good if interwiki.py could check for the presence of a such template and follow the redirect to the new category as given by the template argument.
----------------------------------------------------------------------
>Comment By: Russell Blau (russblau)
Date: 2009-01-09 08:17
Message:
category_redirect.py already contains a list of category redirect
templates, although only for a few sites. If it is desired to use this
capability in other bots, then the template lists should probably be moved
into the family files, and an is_category_redirect() method added to the
Category object in catlib.py, or alternatively to the Page object.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-09 06:40
Message:
I now have some code that I believe solves this. But since I'm a beginner
in Python, I'd like someone more experienced to look at my code before it
is submitted.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-08 19:46
Message:
The previous comment was by me. I don't know why I wasn't logged in.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2009-01-08 19:43
Message:
Implementing this feature involves several steps.
First the template needs to be detected. This is similar to isDisambig()
in wikipedia.py. Perhaps that function should also require isCategory(), so
the template is only detected when used in category pages. Unfortunately,
there is no equivalent to the MediaWiki:Disambiguationspage to help us find
out what the template name is in each language, so we have to list the
template translations for each language. I think that should be manageable.
I propose the new function be called isCategoryRedirect(). Then this
function needs to be introduced where isRedirect() is used. Or perhaps
isRedirect() should call it? That would save a lot of work.
Are there some situations where it would be harmful to detect this
template? Should the use of the new function be configurable?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1722782&group_…
Feature Requests item #1722782, was opened at 2007-05-21 17:21
Message generated for change (Comment added) made by aronsson
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1722782&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Byrial Ole Jensen (byrial)
Assigned to: Nobody/Anonymous (nobody)
Summary: interwiki.py should follow category redirect templates
Initial Comment:
Sometimes when a category is moved, a template like [[en:template:Template:Category redirect]] (see its interwiki links for similar templates in other languages) is left at the old category page.
It would be good if interwiki.py could check for the presence of a such template and follow the redirect to the new category as given by the template argument.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-09 12:40
Message:
I now have some code that I believe solves this. But since I'm a beginner
in Python, I'd like someone more experienced to look at my code before it
is submitted.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-09 01:46
Message:
The previous comment was by me. I don't know why I wasn't logged in.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2009-01-09 01:43
Message:
Implementing this feature involves several steps.
First the template needs to be detected. This is similar to isDisambig()
in wikipedia.py. Perhaps that function should also require isCategory(), so
the template is only detected when used in category pages. Unfortunately,
there is no equivalent to the MediaWiki:Disambiguationspage to help us find
out what the template name is in each language, so we have to list the
template translations for each language. I think that should be manageable.
I propose the new function be called isCategoryRedirect(). Then this
function needs to be introduced where isRedirect() is used. Or perhaps
isRedirect() should call it? That would save a lot of work.
Are there some situations where it would be harmful to detect this
template? Should the use of the new function be configurable?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1722782&group_…
Bugs item #2376362, was opened at 2008-12-02 18:27
Message generated for change (Comment added) made by kwj2772
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2376362&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Woo-Jin Kim (kwj2772)
Assigned to: Nobody/Anonymous (nobody)
Summary: checkimages.py - allowed template is not hidden templates
Initial Comment:
pywikipedia r6122
In ko.wp. Hidden templates are considered as license templates. source code should be changed from:
# A page where there's a list of template to consider as licenses.
PageWithAllowedTemplates = {
'commons': u'User:Filbot/Allowed templates',
'en':None,
'it':u'Progetto:Coordinamento/Immagini/Bot/AllowedTemplates',
'ko':u'User:Kwjbot_IV/whitetemplates/list',
}
to
# A page where there's a list of template to consider as licenses.
PageWithAllowedTemplates = {
'commons': u'User:Filbot/Allowed templates',
'en':None,
'it':u'Progetto:Coordinamento/Immagini/Bot/AllowedTemplates',
'ko':u'User:Kwjbot_IV/AllowedTemplates',
}
Thank you.
----------------------------------------------------------------------
>Comment By: Woo-Jin Kim (kwj2772)
Date: 2009-01-09 16:23
Message:
And Please also change "그림" to "파일" due to namespace change.
Thanks.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2376362&group_…
Feature Requests item #1722782, was opened at 2007-05-21 17:21
Message generated for change (Comment added) made by aronsson
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1722782&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Byrial Ole Jensen (byrial)
Assigned to: Nobody/Anonymous (nobody)
Summary: interwiki.py should follow category redirect templates
Initial Comment:
Sometimes when a category is moved, a template like [[en:template:Template:Category redirect]] (see its interwiki links for similar templates in other languages) is left at the old category page.
It would be good if interwiki.py could check for the presence of a such template and follow the redirect to the new category as given by the template argument.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-09 01:46
Message:
The previous comment was by me. I don't know why I wasn't logged in.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2009-01-09 01:43
Message:
Implementing this feature involves several steps.
First the template needs to be detected. This is similar to isDisambig()
in wikipedia.py. Perhaps that function should also require isCategory(), so
the template is only detected when used in category pages. Unfortunately,
there is no equivalent to the MediaWiki:Disambiguationspage to help us find
out what the template name is in each language, so we have to list the
template translations for each language. I think that should be manageable.
I propose the new function be called isCategoryRedirect(). Then this
function needs to be introduced where isRedirect() is used. Or perhaps
isRedirect() should call it? That would save a lot of work.
Are there some situations where it would be harmful to detect this
template? Should the use of the new function be configurable?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1722782&group_…