Eric Radman wrote:
What is the appropriate way to redirect a web browser to another page? This is
what I'm doing now:

from WebKit.Page import Page

class login(Page):
  def actions(self):
    return Page.actions(self) + ["submit"]

  def submit(self):
    trans = self.transaction()
    if password = "xxxxx":
      trans.response().sendRedirect("welcome")

This does call the next servlet called 'welcome', but before it does the
following is written to the response object:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
   <title>welcome</title>
</head>
<body color=black bgcolor=white>

Do I need to call some sort of flush() function before redirecting the response?

There's a method preAction that is writing this stuff out. And actually, I was just going to post a suggested change to that. But anyway, you can make preAction() do nothing to get rid of that code.


Also, you might want to use self.sendRedirectAndEnd(url), though I don't think it will help you in this situation.

Ian


------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to