Steve Lianoglou <mailinglist.honeypot <at> gmail.com> writes:

<snip>

> This is all fine so far, but I'm curious if/how I can make the URL that I 
> report
> in my `page_header1` to be dynamic, like it is on the moinmoin.wikiweb.de
> site
> so that it can return the appropriate URL for the same page on the new
> server
> that the user is trying to access on the old server.
> 
> So, in the header, when the user tries to access this page:
> http://example.com/cgi-bin/moin.cgi/SomePage
> 
> I'd like to convert it to:
> http://new.example.com/SomePage
> 
> (we moved from cgi to mod_wsgi, to boot)
</snip>

Replying to myself, and for posterity ...

When run as a CGI, the os.environ['REQUEST_URI'] has the
"/cgi-bin/moin.cgi/SomePage" part of the request.

You can grab that string, mangle it however you like, and use it in the
page_header/footer. So in the specific case I outlined above, I can do 
something like this:

    import os
    _new_url = 'http://new.example.com/%s' % os.environ['REQUEST_URI'][18:]
    page_header1 = '<p>The new URL for this page is: ' \
                   '<a href="%s">%s</a></p>' % (_new_url, _new_url)

And the new address will be listed at the top of every page ... 
style w/ custom message and css to taste.

-steve



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Moin-user mailing list
Moin-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/moin-user

Reply via email to