Revision: 4022
Author: btongminh
Date: 2007-08-09 19:13:07 +0000 (Thu, 09 Aug 2007)
Log Message:
-----------
Add bug section; Fix bug that changes replace into delete; Flush the standard streams on exit;
Modified Paths:
--------------
trunk/pywikipedia/delinker.py
Modified: trunk/pywikipedia/delinker.py
===================================================================
--- trunk/pywikipedia/delinker.py 2007-08-09 17:33:37 UTC (rev 4021)
+++ trunk/pywikipedia/delinker.py 2007-08-09 19:13:07 UTC (rev 4022)
@@ -29,6 +29,10 @@
# TODO:
# * Don't replace within <nowiki /> tags
# * Make as many config settings site dependend
+# BUGS:
+# * There is a problem with images in the es.wikisource project namespace.
+# The exact problem is described somewhere in Bryan's IRC logs, but it is
+# unknown where exactly.
import sys, os, threading, time
import traceback
@@ -130,7 +134,7 @@
if skipped_images:
time.sleep(self.CommonsDelinker.config['timeout'])
- return self.delink_image(image, skipped_images, timestamp, admin, reason)
+ return self.delink_image(image, skipped_images, timestamp, admin, reason, replacement)
elif replacement:
# Let them know that we are done replacing.
self.CommonsDelinker.Loggers.append((timestamp, image, replacement))
@@ -793,3 +797,6 @@
finally:
output(u'Stopping CommonsDelinker')
wikipedia.stopme()
+ # Flush the standard streams
+ sys.stdout.flush()
+ sys.stderr.flush()
Revision: 4021
Author: btongminh
Date: 2007-08-09 17:33:37 +0000 (Thu, 09 Aug 2007)
Log Message:
-----------
Grammar fixes
Modified Paths:
--------------
trunk/pywikipedia/delinker.txt
Modified: trunk/pywikipedia/delinker.txt
===================================================================
--- trunk/pywikipedia/delinker.txt 2007-08-09 16:14:13 UTC (rev 4020)
+++ trunk/pywikipedia/delinker.txt 2007-08-09 17:33:37 UTC (rev 4021)
@@ -60,7 +60,7 @@
family. Also setup the usernames[][] variables.
=== Delinker variables ===
-Due to history reasons, the configuration variable is called ''CommonsDelinker''.
+Due to historical reasons, the configuration variable is called ''CommonsDelinker''.
First setup the dictionary ''CommonsDelinker'', by adding to the config:
CommonsDelinker = {}
@@ -84,7 +84,7 @@
[[:Image:$2]] by administrator [[User:$3]]: ''$4''."''
}: Default settings, in case no on-wiki settings are found. For the meaning
of the variables, please refer to [[m:User:CommonsDelinker]].
-* ''global = False'': Set global or local delink. DO NOT RUN THIS BOT ON
+* ''global = False'': Set global or local delink. DO NOT RUN THIS BOT
GLOBALLY WITHOUT CONSULTING BRYAN AND SIEBRAND. Thank you.
* ''no_sysop = True'': Disable delinking as sysop.
@@ -96,6 +96,8 @@
summary, the file is not delinked.
* ''summary_cache = 3600'': Time before on-wiki settings are updated.
+==== Replacer settings ====
+Those variables only need to be set if the replacer is enabled.
* ''replace_template = "replace image"'': The template for to command
replacement.
* ''command_page = "User:CommonsDelinker/commands"'': The page were sysops can
Bugs item #1757382, was opened at 2007-07-20 10:44
Message generated for change (Comment added) made by btongminh
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1757382&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: interwiki
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: DarkoNeko (darkoneko)
Assigned to: Nobody/Anonymous (nobody)
Summary: edit conflit undetected
Initial Comment:
I'm using the freshest version of pywikipediabot (it's certain, as I had to reinstall everything from CVS since my HD crashed a few days ago)
the problem is this diff : http://es.wikipedia.org/w/index.php?title=6_de_febrero&diff=prev&oldid=1012…
the diff taken in account is in fact the previous version,
http://es.wikipedia.org/w/index.php?title=6_de_febrero&diff=prev&oldid=1012…
the time lag of 1hour can be explained by the fact the date page took forever to be analysed, or maybe there was a big bunch of "waiting 5 second because of server lag" too, between the moment it took the page and the moment it wrote it.
But the script didn't detect a change was made to the page in the meanwhile.
----------------------------------------------------------------------
Comment By: Bryan (btongminh)
Date: 2007-08-09 18:45
Message:
Logged In: YES
user_id=1806226
Originator: NO
This fix by Andre Engels causes my bot to always raise an edit conflict on
[[:commons:User:CommonsDelinker/commands]]. If I recall correctly, the sand
box solution gave you an edit token from your normal username, and not from
your sysopname, but I'll check next time before I commit.
----------------------------------------------------------------------
Comment By: SourceForge Robot (sf-robot)
Date: 2007-08-09 04:20
Message:
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
----------------------------------------------------------------------
Comment By: Daniel Herding (wikipedian)
Date: 2007-07-25 23:37
Message:
Logged In: YES
user_id=880694
Originator: NO
I tracked this issue and I think it is now fixed in SVN. Please update
immediately, and please help testing this solution. Here is my SVN commit
message:
Andre Engels did it properly in wikipedia.py CVS r1.927 (SVN r3710) with
the description "Avoid 'solving' edit conflicts by throwing away the
conflicting edit."
Bryan broke it in wikipedia.py CVS r1.950 (SVN r3837) with the
description "Undo the change in r1.927 to get a token of the page itself
instead of the sandbox, to prevent edit conflicts when editting as
sysop."
I basically reverted it to Andre's version. I didn't test if unwanted
edit conflicts are raised when someone edits the sandbox. But even if
that's the case, having an edit conflict here and there is better than
the catastrophic situation that we have at the moment (bots overwrite
other user's changes).
----------------------------------------------------------------------
Comment By: Byrial Ole Jensen (byrial)
Date: 2007-07-23 23:21
Message:
Logged In: YES
user_id=23252
Originator: NO
A new fresh example:
http://en.wikipedia.org/w/index.php?title=2007_FIFA_U-20_World_Cup&diff=pre…
- that edit from 20:29 undid 8 versions made in the previous hour from
19:29 to 20:24.
----------------------------------------------------------------------
Comment By: Byrial Ole Jensen (byrial)
Date: 2007-07-20 20:28
Message:
Logged In: YES
user_id=23252
Originator: NO
I was about to make a similar bug report. Instead I can now give two more
examples of undetected edit conflicts:
-
http://en.wikipedia.org/w/index.php?title=November_7&diff=144478910&oldid=1…
-
http://no.wikipedia.org/w/index.php?title=%C3%85rsta_holmar&diff=2437723&ol…
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1757382&group_…
Bugs item #1770747, was opened at 2007-08-09 14:06
Message generated for change (Comment added) made by misza13
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1770747&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: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: initialisation error
Initial Comment:
My bot fails right at the first LOC
import pagegenerators, wikipedia
with
File "script.py", line 14, in ?
import pagegenerators, wikipedia
File "pagegenerators.py", line 85, in ?
import wikipedia, date, catlib
File "wikipedia.py", line 4217, in ?
getSite()
File "wikipedia.py", line 4128, in getSite
_sites[key] = Site(code=code, fam=fam, user=user)
File "wikipedia.py", line 3101, in __init__
if not language[0].upper() + language[1:] in self.namespaces():
IndexError: string index out of range
Used to work earlier.
----------------------------------------------------------------------
>Comment By: Misza13 (misza13)
Date: 2007-08-09 18:15
Message:
Logged In: YES
user_id=1686644
Originator: NO
Fixed in r4020 - 'wikisource.org' will now use '-' as the language key.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2007-08-09 15:11
Message:
Logged In: NO
my user-config.py:
mylang = 'en'
family = 'wikisource'
usernames['wikisource']['en'] = 'TalBot'
sysopnames['wikisource']['en'] = 'TalBot'
console_encoding = 'utf-8'
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2007-08-09 15:10
Message:
Logged In: NO
I believe the change
--- trunk/pywikipedia/families/wikisource_family.py 2007/07/25
11:56:14 3896
+++ trunk/pywikipedia/families/wikisource_family.py 2007/08/07
19:44:17 3994
@@ -11,6 +11,7 @@
self.name = 'wikisource'
self.langs = {
+ '':'wikisource.org',
'dk':'da.wikisource.org',
'jp':'ja.wikisource.org',
'minnan':'zh-min-nan.wikisource.org',
from revision 3994 to wikisource_family.py is the culprit: the added
language has the empty string as key.
----------------------------------------------------------------------
Comment By: Merlijn S. van Deen (valhallasw)
Date: 2007-08-09 14:12
Message:
Logged In: YES
user_id=687283
Originator: NO
Please post your user-config.py
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1770747&group_…
Revision: 4018
Author: wikipedian
Date: 2007-08-09 14:35:37 +0000 (Thu, 09 Aug 2007)
Log Message:
-----------
don't write color tags to logfile
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2007-08-09 14:16:14 UTC (rev 4017)
+++ trunk/pywikipedia/wikipedia.py 2007-08-09 14:35:37 UTC (rev 4018)
@@ -4460,6 +4460,22 @@
if '*' in config.log or calledModuleName() in config.log:
setLogfileStatus(True)
+colorTagR = re.compile('\03{.*?}', re.UNICODE)
+
+def log(text):
+ """
+ Writes the given text to the logfile.
+ """
+ if logfile:
+ # remove all color markup
+ # TODO: consider pre-compiling this regex for speed improvements
+ plaintext = colorTagR.sub('', text)
+ # save the text in a logfile (will be written in utf-8)
+ logfile.write(plaintext + '\n')
+ logfile.flush()
+
+
+
output_lock = threading.Lock()
input_lock = threading.Lock()
output_cache = []
@@ -4475,6 +4491,10 @@
If toStdout is True, the text will be sent to standard output,
so that it can be piped to another process. All other text will
be sent to stderr. See: http://en.wikipedia.org/wiki/Pipeline_%28Unix%29
+
+ text can contain special sequences to create colored output. These
+ consist of the escape character \03 and the color name in curly braces,
+ e. g. \03{lightpurple}. \03{default} resets the color.
"""
output_lock.acquire()
try:
@@ -4489,10 +4509,7 @@
text = unicode(text, 'utf-8')
except UnicodeDecodeError:
text = unicode(text, 'iso8859-1')
- if logfile:
- # save the text in a logfile (will be written in utf-8)
- logfile.write(text + '\n')
- logfile.flush()
+ log(text)
if input_lock.locked():
cache_output(text, newline = newline, toStdout = toStdout)
else:
Revision: 4016
Author: wikipedian
Date: 2007-08-09 14:11:30 +0000 (Thu, 09 Aug 2007)
Log Message:
-----------
added instructions how to disable logging
Modified Paths:
--------------
trunk/pywikipedia/config.py
Modified: trunk/pywikipedia/config.py
===================================================================
--- trunk/pywikipedia/config.py 2007-08-09 14:10:36 UTC (rev 4015)
+++ trunk/pywikipedia/config.py 2007-08-09 14:11:30 UTC (rev 4016)
@@ -165,6 +165,8 @@
# log = ['interwiki', 'weblinkchecker', 'table2wiki']
# It is also possible to enable logging for all scripts, using this line:
# log = ['*']
+# To disable all logging, use this:
+# log = []
# Per default, logging of interwiki.py is enabled because its logfiles can
# be used to generate so-called warnfiles.
# This setting can be overridden by the -log or -nolog command-line arguments.