Forget that.
The more I think about this the more I convince myself it would be
easier to just piggy back an onerror in route.py and not to implement
it as a WSGI plugin. Implementing it as wsgi would be difficult
because or routes_out. It would also require response parsing and that
would make web2py slower.
Massimo
On Oct 11, 10:12 am, Timbo <[EMAIL PROTECTED]> wrote:
> The only part about what you said that I don't think I get is:
>
> ---
> Ideally all of the processing of routes.py should be done in a
> separate WSGI plugin module since there is no need to modify web2py to
> implement this functionality. It would be sufficient to look for
> web2py_error in the HTTP response header.
> ---
>
> From reading PEP 333, and seeing how Pylons implements error handling,
> what I think you mean is just to beef-up rewrite.py such that instead
> of rewrite() returning lambdas, it would return a full error handler.
> The part that confused me is when you said there would be no need to
> modify web2py...in that context, what is web2py? Is rewrite (or the
> WSGIServer) part of web2py?
>
> -tim
>
> On Oct 10, 5:22 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > Right now there are various types of errors:
>
> > - URL does not pass validation
> > - Invalid controller
> > - Invalid action
> > - Invalid static file
>
> > They all raise HTTP(400,"message",web2py_error="....") and if
>
> > - A ticket is being issues
>
> > It raises HTTP(200) but the page shows the ticket number.
>
> > The value of web2py_error is added as a parameter of the HTTP response
> > header and it was intended as a mechanism to allow SWGI filtering and
> > rewriting of these error messages but not used.
>
> > I would like to extend routes so that it has a new item in it
> > (optional) that says something like
>
> > onerror=(
> > ('myapp:name','200:/myapp/static/error400.html')
> > ('name','200:/examples/static/error400.html')
> > )
>
> > where name is the name of error message (we2py_error). 'myapp:' means
> > this rule only applies to myapp (assuming web2py validates the URL and
> > can determine the app name.
>
> > If the event name happens, web2py will redirect or serve instead
>
> > /myapp/static/error400.html?ticket=....&url=/past/url
>
> > with HTTP 200 status.
>
> > Ideally all of the processing of routes.py should be done in a
> > separate WSGI plugin module since there is no need to modify web2py to
> > implement this functionality. It would be sufficient to look for
> > web2py_error in the HTTP response header.
>
> > Hope I am making sense. I find this a simple and powerful solution.
>
> > Massimo
>
> > On Oct 10, 1:21 pm, Timothy Farrell <[EMAIL PROTECTED]> wrote:
>
> > > I know you're busy, I just don't want this to get lost in the fray. I
> > > don't mean to be naggy. Anyway...
>
> > > I actually had that idea a while ago but never presented because I
> > > thought you would be against it. Anyway, I like this concept better
> > > anyway.
>
> > > Here's an idea:
> > > - Have a generic error page (straight HTML, no processing whatsoever)
> > > - When running an error handler function set a request flag that says
> > > "this is an error handler"
> > > - If an error handler throws an error, serve the generic error page.
>
> > > This is what google does. http://i36.tinypic.com/b3sw03.png
>
> > > If you like this idea or come up with other details, I'll code it if you
> > > like. Just let me know.
>
> > > -tim
>
> > > mdipierro wrote:
> > > > I think in routes.py there should be routes on error for different
> > > > types of error. The problem is this may cause circular references.
>
> > > > Timothy Farrell wrote:
>
> > > >> # ps ax | grep 'dispatcher' | grep -v 'grep' | sed -e "s/ ?.*//"
> > > >> 123456
> > > >> # renice -10 123456
>
> > > >> (just a friendly reminder)
>
> > > >> mdipierro wrote:
>
> > > >>> processing....
>
> > > tfarrell.vcf
> > > < 1KViewDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---