comparison 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
comparison
equal deleted inserted replaced
1811:b7645fb02d1d 1813:dca96e7c8199
63 attach_dir = os.path.join(request.cfg.attachments['dir'], pagename, "attachments") 63 attach_dir = os.path.join(request.cfg.attachments['dir'], pagename, "attachments")
64 if create and not os.path.isdir(attach_dir): 64 if create and not os.path.isdir(attach_dir):
65 os.makedirs(attach_dir) 65 os.makedirs(attach_dir)
66 else: 66 else:
67 # send file via CGI, from page storage area 67 # send file via CGI, from page storage area
68 attach_dir = Page(request, pagename).getPagePath("attachments", check_create=create) 68 if pagename == request.page.page_name:
69 page = request.page # reusing existing page obj is faster
70 else:
71 page = Page(request, pagename)
72 attach_dir = page.getPagePath("attachments", check_create=create)
69 73
70 return attach_dir 74 return attach_dir
71 75
72 def absoluteName(url, pagename): 76 def absoluteName(url, pagename):
73 """ Get (pagename, filename) of an attachment: link 77 """ Get (pagename, filename) of an attachment: link