diff MoinMoin/action/AttachFile.py @ 1813:dca96e7c8199

reuse existing page object
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 24 Feb 2007 20:08:00 +0100
parents cabab80d9597
children 4a31739bc6e1
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sat Feb 24 16:50:42 2007 +0100
+++ b/MoinMoin/action/AttachFile.py	Sat Feb 24 20:08:00 2007 +0100
@@ -65,7 +65,11 @@
             os.makedirs(attach_dir)
     else:
         # send file via CGI, from page storage area
-        attach_dir = Page(request, pagename).getPagePath("attachments", check_create=create)
+        if pagename == request.page.page_name:
+            page  = request.page # reusing existing page obj is faster
+        else:
+            page = Page(request, pagename)
+        attach_dir = page.getPagePath("attachments", check_create=create)
 
     return attach_dir