From: Steve Lianoglou <mailinglist.honeypot@gm...> - 2008-09-22 17:25:12
We're in the process of moving our MoinMoin between servers. When making the
switch, I'm anticipating some time when the domain for our wiki will still point
to the old server while the DNS propogates.
I've setup a temporary domain that people can access the new moin right now. To
ensure no data loss in the conversion and minimize confusion I will be changing
the moin on the old server to be read only, and also added a `page_header1` in
our wikiconfig.py to indicate that the user should be going to the tmp url while
the DNS switches over completely.
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:
I'd like to convert it to:
(we moved from cgi to mod_wsgi, to boot)
Thanks for any help,
From: Steve Lianoglou <mailinglist.honeypot@gm...> - 2008-09-22 23:09:54
Steve Lianoglou <mailinglist.honeypot <at> gmail.com> writes:
> This is all fine so far, but I'm curious if/how I can make the URL that I
> in my `page_header1` to be dynamic, like it is on the moinmoin.wikiweb.de
> so that it can return the appropriate URL for the same page on the new
> that the user is trying to access on the old server.
> So, in the header, when the user tries to access this page:
> I'd like to convert it to:
> (we moved from cgi to mod_wsgi, to boot)
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:
_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.