Package: python-moinmoin
Version: 1.9.1-1
Severity: important
Tags: patch
Hi Jonas,
when the action diff is executed for a nonexistent page or a page with
no editlog entries, an AttributeError will be thrown (see attached
Python traceback). And the web server will report an error 500 or
display the Python traceback.
The upstream authors have fixed¹ this problem. The attached patch has
solved the problem in my installation.
Regards,
Pascal
--
1 = http://hg.moinmo.in/moin/1.9/rev/db8b17d3a967
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing'), (50, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-moinmoin depends on:
ii python 2.5.4-9 An interactive high-level object-o
ii python-parsedatetime 0.8.7-1 Python module to parse human-reada
ii python-pygments 1.2.2+dfsg-1 syntax highlighting package writte
ii python-support 1.0.6 automated rebuilding support for P
ii python-werkzeug 0.5.1-1 collection of utilities for WSGI a
Versions of packages python-moinmoin recommends:
pn fckeditor <none> (no description available)
ii postfix [mail-transport-agen 2.6.5-3 High-performance mail transport ag
ii python-xapian 1.0.17-1+b1 Xapian search engine interface for
ii python-xappy 0.5-2 easy-to-use interface to the Xapia
Versions of packages python-moinmoin suggests:
pn antiword <none> (no description available)
ii apache2 2.2.14-5 Apache HTTP Server metapackage
ii apache2-mpm-worker [httpd 2.2.14-5 Apache HTTP Server - high speed th
pn catdoc <none> (no description available)
pn docbook-dsssl <none> (no description available)
ii miscfiles [wordlist] 1.4.2.dfsg.1-9 Dictionaries and other interesting
ii poppler-utils [xpdf-utils 0.12.2-2 PDF utilitites (based on libpopple
pn python-4suite-xml <none> (no description available)
ii python-docutils 0.6-3 utilities for the documentation of
pn python-flup <none> (no description available)
pn python-gdchart <none> (no description available)
pn python-ldap <none> (no description available)
ii python-mysqldb 1.2.2-10+b1 A Python interface to MySQL
pn python-openid <none> (no description available)
pn python-pyxmpp <none> (no description available)
ii python-tz 2009u-1 Python version of the Olson timezo
pn python-xml <none> (no description available)
pn smbfs <none> (no description available)
ii wamerican-huge [wordlist] 6-3 American English dictionary words
ii wngerman [wordlist] 20091006-3 New German orthography wordlist
-- no debconf information
-- debsums errors found:
debsums: changed file /usr/share/pyshared/MoinMoin/util/SubProcess.py (from
python-moinmoin package)
[Wed Jan 27 15:10:14 2010] [error] [client ::1] mod_wsgi (pid=15794): Exception
occurred processing WSGI script '/srv/www/wiki.example.com/path/to/moin.wsgi'.
[Wed Jan 27 15:10:14 2010] [error] [client ::1] Traceback (most recent call
last):
[Wed Jan 27 15:10:14 2010] [error] [client ::1] File
"/usr/lib/pymodules/python2.5/werkzeug/utils.py", line 248, in __call__
[Wed Jan 27 15:10:14 2010] [error] [client ::1] return self.app(environ,
start_response)
[Wed Jan 27 15:10:14 2010] [error] [client ::1] File
"/usr/lib/pymodules/python2.5/MoinMoin/wsgiapp.py", line 281, in __call__
[Wed Jan 27 15:10:14 2010] [error] [client ::1] response = run(context)
[Wed Jan 27 15:10:14 2010] [error] [client ::1] File
"/usr/lib/pymodules/python2.5/MoinMoin/wsgiapp.py", line 88, in run
[Wed Jan 27 15:10:14 2010] [error] [client ::1] response =
dispatch(request, context, action_name)
[Wed Jan 27 15:10:14 2010] [error] [client ::1] File
"/usr/lib/pymodules/python2.5/MoinMoin/wsgiapp.py", line 136, in dispatch
[Wed Jan 27 15:10:14 2010] [error] [client ::1] response =
handle_action(context, pagename, action_name)
[Wed Jan 27 15:10:14 2010] [error] [client ::1] File
"/usr/lib/pymodules/python2.5/MoinMoin/wsgiapp.py", line 195, in handle_action
[Wed Jan 27 15:10:14 2010] [error] [client ::1]
handler(context.page.page_name, context)
[Wed Jan 27 15:10:14 2010] [error] [client ::1] File
"/usr/lib/pymodules/python2.5/MoinMoin/action/diff.py", line 201, in execute
[Wed Jan 27 15:10:14 2010] [error] [client ::1] 'rev_author':
oldlog.getEditor(request) or _('N/A'),
[Wed Jan 27 15:10:14 2010] [error] [client ::1] AttributeError: 'tuple' object
has no attribute 'getEditor'
# HG changeset patch
# User Thomas Waldmann <tw AT waldmann-edv DOT de>
# Date 1264478620 -3600
# Node ID db8b17d3a967ae051192b40457571b983d782228
# Parent 9b85f7601772a3d6cdbadffc59ef75474db2b310
Fixed MoinMoinBugs/1.9DiffActionThrowsException (details see below)
handle the case when we do not find both editlog entries for the diffed revs:
* page does not exist at all (and never did)
* one or both revs have no editlog entry
* because those revs never existed
* because editlog is damaged
add logging
delay start of content output, so we can use theme.add_msg before
diff -r 9b85f7601772 -r db8b17d3a967 MoinMoin/action/diff.py
--- a/MoinMoin/action/diff.py Wed Jan 20 16:04:29 2010 +0100
+++ b/MoinMoin/action/diff.py Tue Jan 26 05:03:40 2010 +0100
@@ -8,6 +8,9 @@
@license: GNU GPL, see COPYING for details.
"""
+from MoinMoin import log
+logging = log.getLogger(__name__)
+
from MoinMoin import wikiutil
from MoinMoin.logfile import editlog
from MoinMoin.Page import Page
@@ -68,12 +71,6 @@
rev1 = 1
rev2 = 0
- # Start output
- # This action generates content in the user language
- request.setContentLanguage(request.lang)
-
- request.theme.send_title(_('Diff for "%s"') % (pagename, ),
pagename=pagename, allow_doubleclick=1)
-
if rev1 > 0 and rev2 > 0 and rev1 > rev2 or rev1 == 0 and rev2 > 0:
rev1, rev2 = rev2, rev1
@@ -94,8 +91,24 @@
newrev = rev2
newpage = Page(request, pagename, rev=newrev)
+ oldlog = oldpage.editlog_entry()
+ newlog = newpage.editlog_entry()
+
+ if not oldlog or not newlog:
+ # We use "No log entries found." msg because we already have i18n
+ # for that. Better would "At least one log entry was not found.".
+ request.theme.add_msg(_("No log entries found."), "error")
+ currentpage.send_page()
+ return
+
edit_count = abs(newrev - oldrev)
+ # Start output
+ # This action generates content in the user language
+ request.setContentLanguage(request.lang)
+
+ request.theme.send_title(_('Diff for "%s"') % (pagename, ),
pagename=pagename, allow_doubleclick=1)
+
f = request.formatter
request.write(f.div(1, id="content"))
@@ -163,9 +176,6 @@
request.write(f.rawHTML(navigation_html))
- oldlog = oldpage.editlog_entry()
- newlog = newpage.editlog_entry()
-
def rev_nav_link(enabled, old_rev, new_rev, caption, css_classes,
enabled_title, disabled_title):
if enabled:
return currentpage.link_to(request, on=1, querystr={