Revision: 3899
Author: wikipedian
Date: 2007-07-25 21:33:20 +0000 (Wed, 25 Jul 2007)
Log Message:
-----------
fixed serious bug [ 1757382 ] edit conflit undetected
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).
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2007-07-25 20:19:06 UTC (rev 3898)
+++ trunk/pywikipedia/wikipedia.py 2007-07-25 21:33:20 UTC (rev 3899)
@@ -1038,10 +1038,10 @@
If watchArticle is None, leaves the watchlist status unchanged.
"""
- # Fetch the page to get an edit token. If we already have
+ # Fetch a page to get an edit token. If we already have
# fetched a page, this will do nothing, because get() is cached.
try:
- self.get(force = True, get_redirect = True)
+ self.site().sandboxpage.get(force = True, get_redirect = True)
except NoPage:
pass
Can someone explain how to do a commit to the new repository? I'm using
TortoiseSVN on a Windows XP machine. Checking out the files worked fine;
but trying to commit gets me the following error:
C:\...\pywikipedia>svn commit wikipedia.py --username russblau --message
"Catch NoPage exception in Page.templates()"
svn: Commit failed (details follow):
svn: Can't create directory
'/svnroot/pywikipedia/db/transactions/3896-1.txn': P
ermission denied
I've got developer access (right?) and I've got my SSH key loaded in
Pageant. What else do I need to do to be able to commit?
Russ
Hello,
I have a problem while running the last pywikipedia revisions. I am
perfectly using an older revision (I got it on June 26), without any
problem.
Now, with the latest revisions, the bot can't change any page, so I am
unable to use it. It returns a long error traceback, finishing like this:
...
File "/etc/new/pywikipedia/wikipedia.py", line 562, in getEditPage
text = self.site().getUrl(path, sysop = sysop)
File "/etc/new/pywikipedia/wikipedia.py", line 3345, in getUrl
import StringIO, gzip
File "/usr/lib/python2.5/gzip.py", line 9, in <module>
import zlib
ImportError: /usr/lib/python2.5/lib-dynload/zlib.so: undefined symbol:
inflateCopy
This error occurs with all the scripts, because it comes from the
wikipedia.py file, when using the getUrl function.
I'm using Python 2.5 on Ubuntu 7.04. Does anybody know what's happening?
Thank you very much.
Regards,
Arkaitz Zubiaga
Revision: 3894
Author: misza13
Date: 2007-07-22 16:24:17 +0000 (Sun, 22 Jul 2007)
Log Message:
-----------
Adding some introductory documentation; making exceptions subclass from wikipedia.Error rather than from Exception.
Modified Paths:
--------------
trunk/pywikipedia/archivebot.py
Modified: trunk/pywikipedia/archivebot.py
===================================================================
--- trunk/pywikipedia/archivebot.py 2007-07-20 14:18:11 UTC (rev 3893)
+++ trunk/pywikipedia/archivebot.py 2007-07-22 16:24:17 UTC (rev 3894)
@@ -1,10 +1,31 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-General purpose archiving bot.
+archivebot.py - discussion page archiving bot.
-To get usage help, type:
- python archivebot.py --help
+usage:
+
+ python archivebot.py [OPTIONS] TEMPLATE_PAGE
+
+Bot examines backlinks (Special:Whatlinkshere) to TEMPLATE_PAGE.
+Then goes through all pages (unless a specific page specified using options)
+and archives old discussions. This is done by breaking a page into threads,
+then scanning each thread for timestamps. Threads older than a specified
+treshold are then moved to another page (the archive), which can be named
+either basing on the thread's name or then name can contain a counter which
+will be incremented when the archive reaches a certain size.
+
+Options:
+ -h, --help show this help message and exit
+ -f FILE, --file=FILE load list of pages from FILE
+ -p PAGE, --page=PAGE archive a single PAGE
+ -n NAMESPACE, --namespace=NAMESPACE
+ only archive pages from a given namespace
+ -s SALT, --salt=SALT specify salt
+ -F, --force override security options
+ -c PAGE, --calc=PAGE calculate key for PAGE and exit
+ -l LOCALE, --locale=LOCALE
+ switch to locale LOCALE
"""
#
# (C) Misza13, 2006-2007
@@ -18,7 +39,7 @@
import re, time, locale, traceback, string
-try:
+try: #Get a constructor for the MD5 hash object
import hashlib
new_hash = hashlib.md5
except ImportError: #Old python?
@@ -26,20 +47,22 @@
new_hash = md5.md5
-class MalformedConfigError(Exception):
- pass
+class MalformedConfigError(wikipedia.Error):
+ """There is an error in the configuration template."""
-class MissingConfigError(Exception):
- pass
+class MissingConfigError(wikipedia.Error):
+ """The config is missing in the header (either it's in one of the threads
+ or transcluded from another page)."""
-class AlgorithmError(Exception):
- pass
+class AlgorithmError(MalformedConfigError):
+ """Invalid specification of archiving algorithm."""
-class ArchiveSecurityError(Exception):
- pass
+class ArchiveSecurityError(wikipedia.Error):
+ """Archive is not a subpage of page being archived and key not specified
+ (or incorrect)."""
def str2time(str):
@@ -75,14 +98,18 @@
def int2month(num):
+ """Returns the locale's full name of month 'num' (1-12)."""
return locale.nl_langinfo(locale.MON_1+num-1).decode('utf-8')
def int2month_short(num):
+ """Returns the locale's abbreviated name of month 'num' (1-12)."""
return locale.nl_langinfo(locale.ABMON_1+num-1).decode('utf-8')
def txt2timestamp(txt, format):
+ """Attempts to convert the timestamp 'txt' according to given 'format'.
+ On success, returns the time tuple; on failure, returns None."""
try:
return time.strptime(txt,format)
except ValueError:
Hello,
Every member from the old pywikipediabot-users mailing list has been added
to this new, fast, shiny, no-spam-in-footer, etc mailing list. Once no bug
tracker reports need to be sent to the old mailing list, that list will be
closed.
If you find any bugs with this mailing list, please first check your
membership bits (I have set them, but it seems I am human and hence
error-prone) and if that does not solve the problem, please mail me or, if
it is a mailman bug, put in on wikimedia's bugzilla.
--valhallasw