changeset 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 b7645fb02d1d
children 11b75f065ebd
files MoinMoin/action/AttachFile.py MoinMoin/theme/__init__.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
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
 
--- a/MoinMoin/theme/__init__.py	Sat Feb 24 16:50:42 2007 +0100
+++ b/MoinMoin/theme/__init__.py	Sat Feb 24 20:08:00 2007 +0100
@@ -811,7 +811,7 @@
         @return: rss href
         """
         request = self.request
-        url = Page(request, 'RecentChanges').url(request, querystr={
+        url = page.url(request, querystr={
                 'action':'rss_rc', 'ddiffs': '1', 'unique': '1', }, escape=0, relative=False)
         return url