Revision: 5306
Author: purodha
Date: 2008-05-05 14:32:15 +0000 (Mon, 05 May 2008)
Log Message:
-----------
We do not necessarily log in to Wikipedia, but other wiki sites as well.
Modified Paths:
--------------
trunk/pywikipedia/login-data/README
Modified: trunk/pywikipedia/login-data/README
===================================================================
--- trunk/pywikipedia/login-data/README 2008-05-05 10:15:22 UTC (rev 5305)
+++ trunk/pywikipedia/login-data/README 2008-05-05 14:32:15 UTC (rev 5306)
@@ -1,3 +1,3 @@
This directory/folder is "empty" when you get the package. It is
-reserved to contain login data for the robots for all of the wikipedia
+reserved to contain login data for the robots for all of the wiki
sites you make it log in to.
Patches item #1911954, was opened at 2008-03-11 16:22
Message generated for change (Comment added) made by wikipedian
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1911954&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: Accepted
Priority: 5
Private: No
Submitted By: AndreasJS (andreasjs)
Assigned to: Nobody/Anonymous (nobody)
Summary: wikipedia.py recursive redirect + various fixes
Initial Comment:
Page.getRedirectTarget(recursive = True): follow redirects, can raise exception InfiniteLoop
Page.title(): Esperanto decoding, fix bug 1425206 and patch 1880140
Page._putPage(): add page name to ServerError message
Page.move(): add NoPage and PageNotSaved exceptions
Page.delete(mark = True): add delete reason as parameter to {{Delete}} tag
getLanguageLinks(): allow interwiki links like :en: pointing to Main Page
----------------------------------------------------------------------
>Comment By: Daniel Herding (wikipedian)
Date: 2008-05-05 12:15
Message:
Logged In: YES
user_id=880694
Originator: NO
All changes applied, except for the changes to Page.getRedirectTarget().
----------------------------------------------------------------------
Comment By: Daniel Herding (wikipedian)
Date: 2008-05-05 12:06
Message:
Logged In: YES
user_id=880694
Originator: NO
> Page.getRedirectTarget(recursive = True): follow redirects, can raise
> exception InfiniteLoop
I don't think this is useful, as long as MediaWiki doesn't follow
recursive redirects either.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1911954&group_…
Patches item #1911954, was opened at 2008-03-11 16:22
Message generated for change (Comment added) made by wikipedian
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1911954&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: AndreasJS (andreasjs)
Assigned to: Nobody/Anonymous (nobody)
Summary: wikipedia.py recursive redirect + various fixes
Initial Comment:
Page.getRedirectTarget(recursive = True): follow redirects, can raise exception InfiniteLoop
Page.title(): Esperanto decoding, fix bug 1425206 and patch 1880140
Page._putPage(): add page name to ServerError message
Page.move(): add NoPage and PageNotSaved exceptions
Page.delete(mark = True): add delete reason as parameter to {{Delete}} tag
getLanguageLinks(): allow interwiki links like :en: pointing to Main Page
----------------------------------------------------------------------
>Comment By: Daniel Herding (wikipedian)
Date: 2008-05-05 12:06
Message:
Logged In: YES
user_id=880694
Originator: NO
> Page.getRedirectTarget(recursive = True): follow redirects, can raise
> exception InfiniteLoop
I don't think this is useful, as long as MediaWiki doesn't follow
recursive redirects either.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1911954&group_…
Bugs item #1957209, was opened at 2008-05-04 15:08
Message generated for change (Settings changed) made by rotemliss
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1957209&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: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Dami (bdamokos)
Assigned to: Nobody/Anonymous (nobody)
Summary: Hungarian localised version of #REDIRECT not recognised
Initial Comment:
In Hungarian #REDIRECT has a localised version: #ÁTIRÁNYÍTÁS.
It would be nice if the pywiki recognised it alogside the English version (maybe even use it as default?, but that's not so important).
The Hungarian version of #ÁTIRÁNYÍTÁS can be seen in action at: hu.wikipedia.org/wiki/Starcraft
----------------------------------------------------------------------
>Comment By: Rotem Liss (rotemliss)
Date: 2008-05-04 16:48
Message:
Logged In: YES
user_id=1327030
Originator: NO
Added in r5303.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1957209&group_…
Bugs item #1957209, was opened at 2008-05-04 14:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1957209&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: Dami (bdamokos)
Assigned to: Nobody/Anonymous (nobody)
Summary: Hungarian localised version of #REDIRECT not recognised
Initial Comment:
In Hungarian #REDIRECT has a localised version: #ÁTIRÁNYÍTÁS.
It would be nice if the pywiki recognised it alogside the English version (maybe even use it as default?, but that's not so important).
The Hungarian version of #ÁTIRÁNYÍTÁS can be seen in action at: hu.wikipedia.org/wiki/Starcraft
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1957209&group_…
Revision: 5302
Author: russblau
Date: 2008-05-03 17:43:01 +0000 (Sat, 03 May 2008)
Log Message:
-----------
Turn off threading on PreloadingGenerator because of bugs
Modified Paths:
--------------
trunk/pywikipedia/pagegenerators.py
trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/pagegenerators.py
===================================================================
--- trunk/pywikipedia/pagegenerators.py 2008-05-03 13:05:23 UTC (rev 5301)
+++ trunk/pywikipedia/pagegenerators.py 2008-05-03 17:43:01 UTC (rev 5302)
@@ -728,7 +728,8 @@
if not page.isTalkPage():
yield page.toggleTalkPage()
-class PreloadingGenerator(ThreadedGenerator):
+
+class PreloadingGenerator(object):
"""
Yields the same pages as generator generator. Retrieves 60 pages (or
another number specified by pageNumber), loads them using
@@ -740,10 +741,10 @@
def __init__(self, generator, pageNumber=60, lookahead=10):
self.wrapped_gen = generator
self.pageNumber = pageNumber
- ThreadedGenerator.__init__(self, name="Preloading-Thread",
- qsize=lookahead)
+# ThreadedGenerator.__init__(self, name="Preloading-Thread",
+# qsize=lookahead)
- def generator(self):
+ def __iter__(self):
try:
# this array will contain up to pageNumber pages and will be flushed
# after these pages have been preloaded and yielded.
Modified: trunk/pywikipedia/replace.py
===================================================================
--- trunk/pywikipedia/replace.py 2008-05-03 13:05:23 UTC (rev 5301)
+++ trunk/pywikipedia/replace.py 2008-05-03 17:43:01 UTC (rev 5302)
@@ -332,76 +332,73 @@
"""
# Run the generator which will yield Pages which might need to be
# changed.
- try:
- for page in self.generator:
- if self.isTitleExcepted(page.title()):
- wikipedia.output(
- u'Skipping %s because the title is on the exceptions list.'
- % page.aslink())
- continue
- try:
- # Load the page's text from the wiki
- original_text = page.get(get_redirect=True)
- if not page.canBeEdited():
- wikipedia.output(u"You can't edit page %s"
- % page.aslink())
- continue
- except wikipedia.NoPage:
- wikipedia.output(u'Page %s not found' % page.aslink())
- continue
- if self.isTextExcepted(original_text):
- wikipedia.output(
- u'Skipping %s because it contains text that is on the exceptions list.'
- % page.aslink())
- continue
- new_text = self.doReplacements(original_text)
- if new_text == original_text:
- wikipedia.output('No changes were necessary in %s'
+ for page in self.generator:
+ if self.isTitleExcepted(page.title()):
+ wikipedia.output(
+ u'Skipping %s because the title is on the exceptions list.'
+ % page.aslink())
+ continue
+ try:
+ # Load the page's text from the wiki
+ original_text = page.get(get_redirect=True)
+ if not page.canBeEdited():
+ wikipedia.output(u"You can't edit page %s"
% page.aslink())
continue
- if self.recursive:
+ except wikipedia.NoPage:
+ wikipedia.output(u'Page %s not found' % page.aslink())
+ continue
+ if self.isTextExcepted(original_text):
+ wikipedia.output(
+u'Skipping %s because it contains text that is on the exceptions list.'
+ % page.aslink())
+ continue
+ new_text = self.doReplacements(original_text)
+ if new_text == original_text:
+ wikipedia.output('No changes were necessary in %s'
+ % page.aslink())
+ continue
+ if self.recursive:
+ newest_text = self.doReplacements(new_text)
+ while (newest_text!=new_text):
+ new_text = newest_text
newest_text = self.doReplacements(new_text)
- while (newest_text!=new_text):
- new_text = newest_text
- newest_text = self.doReplacements(new_text)
- if hasattr(self, "addedCat"):
- cats = page.categories(nofollow_redirects=True)
- if self.addedCat not in cats:
- cats.append(self.addedCat)
- new_text = wikipedia.replaceCategoryLinks(new_text,
- cats)
- # Show the title of the page we're working on.
- # Highlight the title in purple.
- wikipedia.output(u"\n\n>>> \03{lightpurple}%s\03{default} <<<"
- % page.title())
- wikipedia.showDiff(original_text, new_text)
- if not self.acceptall:
- choice = wikipedia.inputChoice(
- u'Do you want to accept these changes?',
- ['Yes', 'No', 'All'], ['y', 'N', 'a'], 'N')
- if choice in ['a', 'A']:
- self.acceptall = True
- if choice in ['y', 'Y']:
- page.put_async(new_text)
- if self.acceptall:
- try:
- page.put(new_text)
- except wikipedia.EditConflict:
- wikipedia.output(u'Skipping %s because of edit conflict'
- % (page.title(),))
- except wikipedia.SpamfilterError, e:
- wikipedia.output(
- u'Cannot change %s because of blacklist entry %s'
- % (page.title(), e.url))
- except wikipedia.PageNotSaved, error:
- wikipedia.output(u'Error putting page: %s'
- % (error.args,))
- except wikipedia.LockedPage:
- wikipedia.output(u'Skipping %s (locked page)'
- % (page.title(),))
- finally:
- self.generator.stop()
+ if hasattr(self, "addedCat"):
+ cats = page.categories(nofollow_redirects=True)
+ if self.addedCat not in cats:
+ cats.append(self.addedCat)
+ new_text = wikipedia.replaceCategoryLinks(new_text,
+ cats)
+ # Show the title of the page we're working on.
+ # Highlight the title in purple.
+ wikipedia.output(u"\n\n>>> \03{lightpurple}%s\03{default} <<<"
+ % page.title())
+ wikipedia.showDiff(original_text, new_text)
+ if not self.acceptall:
+ choice = wikipedia.inputChoice(
+ u'Do you want to accept these changes?',
+ ['Yes', 'No', 'All'], ['y', 'N', 'a'], 'N')
+ if choice in ['a', 'A']:
+ self.acceptall = True
+ if choice in ['y', 'Y']:
+ page.put_async(new_text)
+ if self.acceptall:
+ try:
+ page.put(new_text)
+ except wikipedia.EditConflict:
+ wikipedia.output(u'Skipping %s because of edit conflict'
+ % (page.title(),))
+ except wikipedia.SpamfilterError, e:
+ wikipedia.output(
+ u'Cannot change %s because of blacklist entry %s'
+ % (page.title(), e.url))
+ except wikipedia.PageNotSaved, error:
+ wikipedia.output(u'Error putting page: %s'
+ % (error.args,))
+ except wikipedia.LockedPage:
+ wikipedia.output(u'Skipping %s (locked page)'
+ % (page.title(),))
def prepareRegexForMySQL(pattern):
pattern = pattern.replace('\s', '[:space:]')
In replace.py, v5269 def run(self) calls:
finally:
self.generator.stop()
Message on the screen:
> AttributeError: 'generator' object has no attribute 'stop'
>
--
Bináris