changeset 3605:d0b5d160d255

fix action=info on page that never existed
author Johannes Berg <johannes AT sipsolutions DOT net>
date Sat, 17 May 2008 11:23:53 +0200
parents 3b265efc5eb2
children 510022f50e79
files MoinMoin/action/diff.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/diff.py	Thu May 15 00:46:06 2008 +0200
+++ b/MoinMoin/action/diff.py	Sat May 17 11:23:53 2008 +0200
@@ -102,13 +102,22 @@
     oldrev = oldpage.get_real_rev()
     newrev = newpage.get_real_rev()
 
+    revlist = currentpage.getRevList()
+
+    # code below assumes that the page exists and has at least
+    # one revision in the revlist, just bail out if not. Users
+    # shouldn't really run into this anyway.
+    if not revlist:
+        request.write(f.div(0)) # end content div
+        request.theme.send_footer(pagename)
+        request.theme.send_closing_html()
+        return
+
     title = _('Differences between revisions %d and %d') % (oldrev, newrev)
     if edit_count > 1:
         title += ' ' + _('(spanning %d versions)') % (edit_count, )
     title = f.text(title)
 
-    revlist = currentpage.getRevList()
-
     # Revision list starts from 2...
     if oldrev == min(revlist):
         disable_prev = u' disabled="true"'