diff MoinMoin/action/AttachFile.py @ 623:088282ae5cf3

move twikidraw saving stuff from request to AttachFile, ok for CGI, needs tests for Twisted and WSGI
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 07 May 2006 18:04:51 +0200
parents cf420addd95c
children f18b06c790d4 28de47f4ff1a
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sat May 06 00:09:06 2006 +0200
+++ b/MoinMoin/action/AttachFile.py	Sun May 07 18:04:51 2006 +0200
@@ -348,7 +348,10 @@
     querystr = wikiutil.escape(wikiutil.makeQueryString(querystr))
     pagelink = '%s/%s?%s' % (request.getScriptname(), wikiutil.quoteWikinameURL(pagename), querystr)
     helplink = Page(request, "HelpOnActions/AttachFile").url(request)
-    savelink = Page(request, pagename).url(request) # XXX include target filename param here for twisted
+    querystr = {'action': 'AttachFile', 'do': 'savedrawing'}
+    querystr = wikiutil.escape(wikiutil.makeQueryString(querystr))
+    savelink = '%s/%s?%s' % (request.getScriptname(), wikiutil.quoteWikinameURL(pagename), querystr)
+    #savelink = Page(request, pagename).url(request) # XXX include target filename param here for twisted
                                            # request, {'savename': request.form['drawing'][0]+'.draw'}
     #savelink = '/cgi-bin/dumpform.bat'
 
@@ -445,15 +448,15 @@
     msg = None
     if action_name in request.cfg.actions_excluded:
         msg = _('File attachments are not allowed in this wiki!')
-    elif request.form.has_key('filepath'):
+    elif not request.form.has_key('do'):
+        upload_form(pagename, request)
+    elif request.form['do'][0] == 'savedrawing':
         if request.user.may.write(pagename):
             save_drawing(pagename, request)
             request.http_headers()
             request.write("OK")
         else:
             msg = _('You are not allowed to save a drawing on this page.')
-    elif not request.form.has_key('do'):
-        upload_form(pagename, request)
     elif request.form['do'][0] == 'upload':
         if request.user.may.write(pagename):
             if request.form.has_key('file'):
@@ -495,7 +498,6 @@
     if msg:
         error_msg(pagename, request, msg)
 
-
 def upload_form(pagename, request, msg=''):
     _ = request.getText