Yeh redirect does what I need.

Much appreciate,
garyc
I do use the redirect in the sections of code, but only when I want to
call a method within a controller? I did not know it could be
use to directly call a URL

On Mar 6, 10:18 am, Wyatt Baldwin <[email protected]> wrote:
> On Mar 6, 6:02 am, gazza <[email protected]> wrote:
>
>
>
>
>
> > Hiya,
>
> > I'm running pylong 0.9.7. I want to write a script that opens up an
> > html page on the browser. Another html page will have a link to the
> > python script.
>
> > I inserted some of the code into a controller.
>
> > def redirect(self):
> >      request = urllib2.Request('http://www.python.org/')
> >      try: urllib2.urlopen(request)
> >      except URLError,e:
> >         print e.reason
>
> > I dont see the page being opened?
>
> > I am running my server in test mode at the moment:
>
> >http://127.0.0.1:5000/client/redirect
>
> > Could somebody be so kind an enlighten me on the best approach to
> > accomplish what I am trying to
> > do? I am not even sure if pylons wil allow me to do this? Yes I know
> > http is port 80.
>
> There are easier ways to accomplish a redirect, but... you're not
> seeing anything returned because you need to do a read():
>
> fp = urllib2.urlopen(request)
> content = fp.read()
>
> If you're just doing a regular ol' redirect, you should probably use
> `pylons.controllers.util.redirect` instead.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to