Hi Douglas, I think you are looking for the 'EndResponse' exception. From WebKit/Page.py:
def endResponse(self): """ If this is called during sleep() or awake() then the rest of awake(), response(), and sleep() are skipped and the accumulated response is sent immediately with no further processing. If this is called during respond() then the rest of respond() is skipped but sleep() is called, then the accumulated response is sent. """ So if your code is in a servlet or PSP subclassed from page, just call self.endResponse(). If you are in deeper code (i.e. code called from the PSP or servlet), do: from WebKit.Application import EndResponse raise EndResponse peace, Jason On Wed, 2004-12-01 at 19:19 +0000, Douglas Soares de Andrade wrote: > Hi ! > Well, the return trick stop the application from a def block. > And how to stop the application from a def block that is inside a class ? > Im asking this because i put that soluction in a method on my db class and > the > exception occur and the aplication continue to execute code. > I want to do exactly as PHP die() function, wich stop the execution of the > app > from anywhere it is called. > Thanks in advance. > See ya ! > Em Qua 01 Dez 2004 19:06, Winston Wolff escreveu: > > You could catch the exception and write the error message. Something > > like this (I haven't tested it): > > <% > > try: > > import MySQLdb > > except ImportError: > > self.writeln("You need MySQLdb in the PYTHONPATH or installed > > libraries to run this PSP page.") > > return > > %> > > > > > > If you want a more elaborate error handling system, you could add a > > method writeError() to the base class of your pages and call that, > > which would write out a nice HTML page with your error message. Of > > course for this to work, you need to arrange your pages such that the > > processing and error checking is done before you output any HTML. > > Otherwise, your partially written HTML would be mixed with the HTML > > from writeError(). > > > > -ww > > > > On Dec 1, 2004, at 11:35 AM, Douglas Soares de Andrade wrote: > > > Hi ! > > > > > > Im writing my programs with PSP. Is there a way to report a error and > > > kill the > > > app like the PHP die() function does ? > > > > > > Suppose i have this code : > > > > > > import MySQLdb > > > > > > If i dont have this module i will have the error page. I dont want to > > > let him > > > have the error page, i want to shoot this message: > > > > > > "Dear user... Calm there, this is not the end of the world. The module > > > MySQLdb > > > is not installed." > > > > > > How to do it ? > > > > > > PS: Dont take the user word seriously :) > > > PS2: Dont mind if the solution is in servlet way, it will help me > > > reach the > > > real solution. > > > > > > Thanks for the help > > > > > > -- > > > Douglas Soares de Andrade - UnilesteMG > > > dsa em unilestemg.br - Linux User: #237615 > > > http://douglasandrade.tk > > > > > > > > > > > > ------------------------------------------------------- > > > SF email is sponsored by - The IT Product Guide > > > Read honest & candid reviews on hundreds of IT Products from real > > > users. > > > Discover which products truly live up to the hype. Start reading now. > > > http://productguide.itmanagersjournal.com/ > > > _______________________________________________ > > > Webware-discuss mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/webware-discuss > > > > ------------------------------------------------------- > > SF email is sponsored by - The IT Product Guide > > Read honest & candid reviews on hundreds of IT Products from real users. > > Discover which products truly live up to the hype. Start reading now. > > http://productguide.itmanagersjournal.com/ > > _______________________________________________ > > Webware-discuss mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/webware-discuss ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss