= Description = Problem with sub pages and how to get the right URL from whithin a parser == Steps to reproduce == 1. Create a page with a subpage e.g.{{{ http://localhost:8080/OnePage/TwoPage}}} 1. then attach from modern/img the files idea.png and tired.png to this page 1. call the parser_problem from this page {{{ from MoinMoin.action import AttachFile Dependencies = [] class Parser: def __init__(self, raw, request, **kw): self.raw = raw self.request = request self.form = request.form self._ = request.getText def format(self, formatter): current_pagename=formatter.page.page_name self.request.write(current_pagename) image='idea.png' example='tired.png' small={} small['src']=AttachFile.getAttachUrl(current_pagename,image,self.request) image_link=formatter.image(**small) webn_url="%(pagename)s?action=AttachFile&do=view&target=%(example)s" % { "pagename":current_pagename, "example":example} txt=(formatter.url(1,webn_url)+image_link+formatter.url(0)) self.request.write(txt) }}} == Result == * current_pagename looks good * I got if I look at the url in the status bar or if I copy it from the symbol {{{ http://localhost:8080/OnePage/OnePage/TwoPage?action=AttachFile&do=view&target=tired.png }}} Where does the double ''!OnePage'' comes from? All is ok if I use only !OnePage. If I try {{{ http://localhost:8080/OnePage/TwoPage/ThreePage}}} I got {{{ http://localhost:8080/OnePage/TwoPage/OnePage/TwoPage/ThreePage?action=AttachFile&do=view&target=tired.png }}} That's strange. May be I am blind and I have it in the code. -- ReimarBauer <> Are you referring to image_link or webn_url here? ''image_link is right shown, if I send it to the browser webn_url is right {{{ OnePage/TwoPage?action=AttachFile&do=view&target=tired.png}}} but then if I build the URL by the formatter it goes wrong'' Please use `action.AttachFile.getAttachUrl` in both cases. ''I got another solution. The hint with the absolute URL was perfect. It is easier by using wikiutil.link_tag.'' {{{ text= 'text to show' url = 'where to jump' link = wikiutil.link_tag(self.request, url, text=text, formatter=formatter) self.request.write(link) }}} ''Thanks!'' -- ReimarBauer <> == Details == ## if the bug is in this wiki, just kill the table and write: This Wiki. ## Describe your environment ## example: moin 1.3.0, Mac OS X 10.3.3, Python 2.3.0, Apache 2.0.48 with mod_python 3.1.2b, using SSL and Authentication || '''!MoinMoin Version''' ||1.3.5 || || '''OS and Version''' || debian sarge || || '''Python Version''' || 2.3 || || '''Server Setup''' || standalone|| || '''Server Details''' || localhost|| == Workaround == ## How to deal with the bug until it is fixed = Discussion = = Plan = ## This part is for Moin``Moin developers: * Priority: * Assigned to: * Status: Not a bug. the formatter wants absolute URLs ---- ## When the bug is fixed, replace the category to Category MoinMoinBugFixed ## If this is not a bug, replace with Category MoinMoinNoBug CategoryMoinMoinNoBug