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
  2. then attach from modern/img the files idea.png and tired.png to this page
  3. 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

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 2005-08-06 20:37:43

Details

MoinMoin Version

1.3.5

OS and Version

debian sarge

Python Version

2.3

Server Setup

standalone

Server Details

localhost

Workaround

Discussion

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/ParserProblem (last edited 2007-10-29 19:13:45 by localhost)