diff MoinMoin/action/AttachFile.py @ 2701:398af77c7ede

fixed attachment_link api - it now has a 'on' parameter like most of the other methods
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 19 Aug 2007 22:46:10 +0200
parents 29657277dd37
children 5092edd82058 cdda42a9d8a8
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sun Aug 19 17:17:53 2007 +0200
+++ b/MoinMoin/action/AttachFile.py	Sun Aug 19 22:46:10 2007 +0200
@@ -119,6 +119,21 @@
         url = wikiutil.escape(url)
     return url
 
+def getAttachUploadUrl(pagename, filename, request, addts=0, escaped=0):
+    """ Get URL that points to attachment `filename` of page `pagename` upload url.
+    """
+    if htdocs_access(request):
+        # direct file access via webserver - we don't support uploading files,
+        # so just fake some return value:
+        return getAttachUrl(pagename, filename, request, addts=addts, escaped=escaped)
+    else:
+        url = "%s/%s?action=%s&rename=%s" % (
+            request.getScriptname(), wikiutil.quoteWikinameURL(pagename),
+            action_name, wikiutil.url_quote_plus(filename))
+    if escaped:
+        url = wikiutil.escape(url)
+    return url
+
 def getIndicator(request, pagename):
     """ Get an attachment indicator for a page (linked clip image) or
         an empty string if not attachments exist.