changeset 457:f423a8496ae3

moved action=raw implementation to Page object imported from: moin--main--1.5--patch-461
author Thomas Waldmann <tw@waldmann-edv.de>
date Sun, 26 Feb 2006 19:20:17 +0000
parents 12b6367214e3
children 4110fdc3c1ff
files ChangeLog MoinMoin/Page.py MoinMoin/wikiaction.py
diffstat 3 files changed, 45 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Feb 26 18:21:38 2006 +0000
+++ b/ChangeLog	Sun Feb 26 19:20:17 2006 +0000
@@ -2,6 +2,20 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-02-26 20:20:17 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-461
+
+    Summary:
+      moved action=raw implementation to Page object
+    Revision:
+      moin--main--1.5--patch-461
+
+    moved action=raw implementation to Page object
+    
+
+    modified files:
+     ChangeLog MoinMoin/Page.py MoinMoin/wikiaction.py
+
+
 2006-02-26 19:21:38 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-460
 
     Summary:
--- a/MoinMoin/Page.py	Sun Feb 26 18:21:38 2006 +0000
+++ b/MoinMoin/Page.py	Sun Feb 26 19:20:17 2006 +0000
@@ -10,7 +10,7 @@
 
 from MoinMoin import config, caching, user, util, wikiutil
 from MoinMoin.logfile import eventlog
-from MoinMoin.util import filesys
+from MoinMoin.util import filesys, MoinMoinNoFooter
 from MoinMoin.util.datetime import formathttpdate
 
 class Page:
@@ -943,6 +943,35 @@
         return subscriber_list
 
 
+    def send_raw(self):
+        """ Output the raw page data (action=raw) """
+        request = self.request
+        pagename = self.page_name
+        if not request.user.may.read(pagename):
+            Page(request, pagename).send_page(request)
+            return
+
+        request.http_headers(["Content-type: text/plain;charset=%s" % config.charset])
+
+        if request.form.has_key('rev'):
+            try:
+                rev = request.form['rev'][0]
+                try:
+                    rev = int(rev)
+                except StandardError:
+                    rev = 0
+            except KeyError:
+                rev = 0
+            page = Page(request, pagename, rev=rev)
+        else:
+            page = Page(request, pagename)
+
+        text = page.get_raw_body()
+        text = page.encodeTextMimeType(text)
+        request.write(text)
+        raise MoinMoinNoFooter
+
+
     def send_page(self, request, msg=None, **keywords):
         """ Output the formatted page.
 
--- a/MoinMoin/wikiaction.py	Sun Feb 26 18:21:38 2006 +0000
+++ b/MoinMoin/wikiaction.py	Sun Feb 26 19:20:17 2006 +0000
@@ -771,30 +771,7 @@
 #############################################################################
 
 def do_raw(pagename, request):
-    if not request.user.may.read(pagename):
-        Page(request, pagename).send_page(request)
-        return
-
-    request.http_headers(["Content-type: text/plain;charset=%s" % config.charset])
-
-    if request.form.has_key('rev'):
-        try:
-            rev = request.form['rev'][0]
-            try:
-                rev = int(rev)
-            except StandardError:
-                rev = 0
-        except KeyError:
-            rev = 0
-        page = Page(request, pagename, rev=rev)
-    else:
-        page = Page(request, pagename)
-
-    text = page.get_raw_body()
-    text = page.encodeTextMimeType(text)
-    request.write(text)
-    raise MoinMoinNoFooter
-
+    Page(request, pagename).send_raw()
 
 def do_format(pagename, request):
     # get the MIME type