self.error() in webapp also clears anything that's previously been put
into the response, so after the call to error() you can send a pretty
error page with self.response.out.write() calls.

On Sep 14, 8:06 pm, OvermindDL1 <[email protected]> wrote:
> On Mon, Sep 14, 2009 at 2:58 PM, PatHaugen <[email protected]> wrote:
>
> > I'm with you, I prefer in scripting languages to have a single file to
> > hold most of my project so I can backup and work on it anywhere
> > easily.
>
> > I used to store page output to a variable in PHP and add to it as the
> > code executed, sending to the user only at the end of file and just
> > trashing that variable if there was an error. Sounds similar to what
> > you're hinting at.
>
> Basically yep.  I created a tree structure in my classes like this:
> class someController(myBaseController):
>   def index(request,response):
>     # do stuff
>
> And if I set someController as a variable in another controller or I
> stuffed it in as the root controller, say I did a root controller,
> then anytime I did my_website.com/index then it would call the above.
> The request includes all headers parsed out, the full uri parsed out,
> and a lot of other stuff, it is designed to be immutable.  The
> response has a header that you can stuff headers in, a content to
> stuff the response webpage/file/whatever into, etc...
>
> I can literally just do:
>   response.reset(DefaultResponses.error500)
> And it kills the original response, overwriting it with the stuff in
> the pre-built error505 response, then I am free to edit the response
> again as I so wish.  I just have it so if an error is occurred, I do
> something like this:
> class someController(myBaseController):
>   def index(request,response):
>     # this page will always just error 500 out
>     if True:
>       response.reset(DefaultResponses.error500)
>       return
>
> It works quite well for me and my programming style when I am whipping
> up small things, very modular and capable.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to