On Thursday, January 19, 2017 at 4:32:51 AM UTC-5, Carl Hunter Roach wrote: > > thanks. > > I don't like adding UI Text to URLs as it's too easy for 3rd-parties to > generate URls and have your site serve anything they like :) >
Note, this is an *internal* redirect, so the end user never sees the query string passed to the error handler -- they continue to see the original URL in their browser address bar (i.e., the URL of the page that triggered the error). > Your suggestion of ditching the standard HTTP status codes spurs a > thought: I could drop Web2py's HTTP altogether and just redirect to my own > error handler page. That way HTTP remains untouched and it's clearer that > I've written an alternative implementation. > Good point -- since you are triggering the error response yourself, you do have more control. However, I wouldn't necessarily do a standard 303 redirect, as that (a) wastes a round trip to the server, and (b) does not return the proper HTTP response code with the initial response. Instead, though, you can create an error handling function in a model file or module and call it from wherever needed. In that handler, you can set response.status to the appropriate HTTP status code, which will get sent to the browser (along with whatever response is generated by the handler). Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.