Patches item #1794859, was opened at 2007-09-14 19:04
Message generated for change (Comment added) made by pietrodn
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=179485…
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: 8
Private: No
Submitted By: Pietrodn (pietrodn)
Assigned to: Nobody/Anonymous (nobody)
Summary: replace.py "exceptions" patch
Initial Comment:
template.py gives this error:
pietro$ python template.py "Corso di inglese" "Inglese"
Checked for running processes. 2 processes currently running, including the current
process.
Getting references to [[Template:Corso di inglese]]
Getting 31 pages from wikibooks:it...
Traceback (most recent call last):
File "template.py", line 392, in <module>
main()
File "template.py", line 388, in main
bot.run()
File "template.py", line 310, in run
replaceBot.run()
File "/Users/pietro/Applications/pywikipedia/replace.py", line 295, in run
if self.isTitleExcepted(page.title()):
File "/Users/pietro/Applications/pywikipedia/replace.py", line 246, in
isTitleExcepted
if self.exceptions.has_key('title'):
AttributeError: 'list' object has no attribute 'has_key'
This because "exceptions" is treated as a dict by replace.py, but it is a list
and it must iterate through it.
Here is a patch to replace.py.
----------------------------------------------------------------------
Comment By: Pietrodn (pietrodn)
Date: 2007-09-20
17:06
Message:
Logged In: YES
user_id=1887175
Originator: YES
Hello wikipedian! Thank you for your answer.
You're right! In replace.py, in main, there are the following lines:
<pre>
# Don't edit pages which contain certain texts.
exceptions = {
'title': [],
'text-contains': [],
'inside': [],
'inside-tags': [],
}
</pre>
I didn't see them, my solution was incorrect. Thank you for the fix :-)
Pietrodn
----------------------------------------------------------------------
Comment By: Daniel Herding (wikipedian)
Date: 2007-09-20 16:52
Message:
Logged In: YES
user_id=880694
Originator: NO
Thanks for your report. Your observation is correct, however, your
solution doesn't seem to be. Instead, I fixed the problem by setting
exceptions = {} instead of []. Please test the current SVN version.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=179485…