I guess that's not technically a redirect -- it's actually copying the 
other page and delivering the copy. What do you mean it's no longer 
connected to the session? The difficulty with copying a web page and 
delivering the copy is that it might contain some relative URL references 
(links as well as static resources) that will no longer work when being 
delivered from your server. You would have to rewrite the URLs to make them 
absolute (including URLs within any static files linked in the page) and/or 
copy the static resources to your own server. I'm assuming the other URL 
isn't another web2py app that you control, right?

Anyway, Massimo just released Plasmid, which does exactly this (clones an 
external page, converts relative to absolute 
references): https://github.com/mdipierro/Plasmid. You might be able to 
make use of that.

Anthony

On Monday, December 12, 2011 5:10:40 PM UTC-5, peter wrote:
>
> If I have a function as follows in default.py
>
>
> def test():
>     redirect("url of some web page")
>
> Then
>
> app/default/test does open up the web page as if it was entered in the
> url bar  of the browser.
>
> If the function is
>
> def test():
>         import urllib
>         url="url of some web page"
>         f = urllib.urlopen(url)
>         s = f.read()
>         return s
>
> Then it does kind of redirect, but it is no longer connected to the
> session, and the defaults in the html are no longer correct.
>
> Is it possible to alter the routine above to have the same
> functionality as redirect?
>
> The reason I want to be able to do this is that I want to edit s. So I
> want to do a redirect, but with slightly edited html.
>
> Any ideas
> Thanks
> Peter
>
>
>

Reply via email to