"R.Bauer" <rb.p...@gmail.com> writes: > Am 08.12.2011 17:23, schrieb Nikolaus Rath: >>> I would like to include a static menu bar in every rendered page. The >>> menu bar itself should be editable as a page. >>> >>> I came up with the following code to include another page: >>> >>> def includepage(self, page_name): >>> request = self.request >>> inc_page = Page(request, page_name, formatter=request.formatter) >>> if not inc_page.exists(): >>> return '<p><strong class="error">Page %s does not >>> exist</strong></p>' % page_name >>> >>> strfile = StringIO.StringIO() >>> request.redirect(strfile) >>> try: >>> inc_page.send_page(content_only=True, >>> omit_footnotes=True, >>> count_hit=False) >>> return strfile.getvalue() >>> finally: >>> request.redirect() >>> >>> This works nicely, but there is one problem: if, in any page, I refer to >>> an attachment as [[attachment:bla.zip]], then MoinMoin looks for bla.zip >>> in the "navibar" page rather than the page I'm actually viewing. > > some ideas: > * you may be want to use formatter.page.page_name > > * there are themes on the ThemeMarket with an editable Sidebar based > on a wiki page, see http://moinmo.in/ThemeMarket/Mandarin > > * wikiutil.renderText is also your friend.
Thanks! I worked backwards from the Mandarin theme and found that the following works: inc_page = Page(request, page_name) while this messes up the references: inc_page = Page(request, page_name, formatter=request.formatter Can anyone explain to me why the second form is wrong? Best, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ Moin-user mailing list Moin-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/moin-user