changeset 1682:30116d7d098a

request.rev is either revision integer (when given in form) or None
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 19 Nov 2006 20:44:41 +0100
parents fc03cd8ff0f3
children 964fa7d0de32
files MoinMoin/PageEditor.py MoinMoin/PageGraphicalEditor.py MoinMoin/action/__init__.py MoinMoin/action/diff.py MoinMoin/action/edit.py MoinMoin/action/revert.py MoinMoin/request/__init__.py
diffstat 7 files changed, 13 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Sun Nov 19 17:43:01 2006 +0100
+++ b/MoinMoin/PageEditor.py	Sun Nov 19 20:44:41 2006 +0100
@@ -210,7 +210,7 @@
         else:
             title = _('Preview of "%(pagename)s"')
             # Propagate original revision
-            rev = int(form['rev'][0])
+            rev = request.rev
             self.set_raw_body(preview, modified=1)
 
         # send header stuff
--- a/MoinMoin/PageGraphicalEditor.py	Sun Nov 19 17:43:01 2006 +0100
+++ b/MoinMoin/PageGraphicalEditor.py	Sun Nov 19 20:44:41 2006 +0100
@@ -111,7 +111,7 @@
         else:
             title = _('Preview of "%(pagename)s"')
             # Propagate original revision
-            rev = int(form['rev'][0])
+            rev = request.rev
             self.set_raw_body(preview, modified=1)
 
         # send header stuff
--- a/MoinMoin/action/__init__.py	Sun Nov 19 17:43:01 2006 +0100
+++ b/MoinMoin/action/__init__.py	Sun Nov 19 20:44:41 2006 +0100
@@ -212,10 +212,7 @@
     if not request.user.may.read(pagename):
         Page(request, pagename).send_page(request)
     else:
-        try:
-            rev = int(request.form.get('rev', [0])[0])
-        except StandardError:
-            rev = 0
+        rev = request.rev or 0
         Page(request, pagename, rev=rev).send_raw()
 
 def do_show(pagename, request, count_hit=1, cacheable=1):
@@ -227,10 +224,7 @@
         Page(request, pagename).send_page(request)
     else:
         mimetype = request.form.get('mimetype', [u"text/html"])[0]
-        try:
-            rev = int(request.form.get('rev', [0])[0])
-        except StandardError:
-            rev = 0
+        rev = request.rev or 0
         if rev == 0:
             request.cacheable = cacheable
         Page(request, pagename, rev=rev, formatter=mimetype).send_page(request, count_hit=count_hit)
--- a/MoinMoin/action/diff.py	Sun Nov 19 17:43:01 2006 +0100
+++ b/MoinMoin/action/diff.py	Sun Nov 19 20:44:41 2006 +0100
@@ -39,9 +39,8 @@
         rev1 = 0
 
     if rev1 == -1 and rev2 == 0:
-        try:
-            rev1 = int(request.form.get('rev', [-1])[0])
-        except StandardError:
+        rev1 = request.rev
+        if rev1 is None:
             rev1 = -1
 
     # spacing flag?
--- a/MoinMoin/action/edit.py	Sun Nov 19 17:43:01 2006 +0100
+++ b/MoinMoin/action/edit.py	Sun Nov 19 20:44:41 2006 +0100
@@ -49,8 +49,8 @@
     if editor not in valideditors:
         editor = 'text'
 
+    rev = request.rev or 0
     savetext = request.form.get('savetext', [None])[0]
-    rev = int(request.form.get('rev', ['0'])[0])
     comment = request.form.get('comment', [u''])[0]
     category = request.form.get('category', [None])[0]
     rstrip = int(request.form.get('rstrip', ['0'])[0])
--- a/MoinMoin/action/revert.py	Sun Nov 19 17:43:01 2006 +0100
+++ b/MoinMoin/action/revert.py	Sun Nov 19 20:44:41 2006 +0100
@@ -17,7 +17,7 @@
         return Page(request, pagename).send_page(request,
             msg=_('You are not allowed to revert this page!'))
 
-    rev = int(request.form['rev'][0])
+    rev = request.rev
     revstr = '%08d' % rev
     oldpg = Page(request, pagename, rev=rev)
     pg = PageEditor(request, pagename)
--- a/MoinMoin/request/__init__.py	Sun Nov 19 17:43:01 2006 +0100
+++ b/MoinMoin/request/__init__.py	Sun Nov 19 20:44:41 2006 +0100
@@ -175,9 +175,14 @@
                 self.args = {}
                 self.form = {}
                 self.action = 'xmlrpc'
+                self.rev = None
             else:
                 self.args = self.form = self.setup_args()
                 self.action = self.form.get('action', ['show'])[0]
+                try:
+                    self.rev = int(self.form['rev'][0])
+                except:
+                    self.rev = None
 
             from MoinMoin.Page import RootPage
             self.rootpage = RootPage(self)