Ah, I don't do auth that way. A poor choice of example, I guess. A
better one might be:

class some_page(self, arg1, arg2):
    def GET(self, arg1, arg2):
        arg1,arg2 = self.check_args(arg1, arg2)
        ## do something now that I know they're valid

    def POST(self, arg1, arg2):
        some,args = self.check_args(some, args)
        ## ditto

    def check_args(self, arg1, arg2):
        try:
            arg1 = int(arg1)
        except ValueError:
            print 'bad arg1 value!'
            pass ## exit without returning here!
        try:
            arg2 = db_check_or_something(arg2)
        except ValueError:
            print 'bad arg2 value!'
            pass ## exit without returning here!
        return arg1, arg2

Does moving _load(env) like that make the redirect stop executing the
rest of the code? I don't really know how wsgi stuff works.

On Dec 7, 7:09 pm, "Yingbo Qiu" <[EMAIL PROTECTED]> wrote:
> put your check_authenticate in middleware.
>
> BTW: look my yesterday post, I want put the check func() in
> _loadhooks[], but I got the same problem of you
>
> On 12/8/07, Zack <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Is there a good way to end the current request instead of returning
> > all the way out to GET() or POST()?
>
> > For example:
>
> > clas secret_page(self):
> >     def GET(self):
> >         self.ok()
> >         print "it seems like you're ok"
> >     def POST(self):
> >         self.ok()
> >         print "it still seems like you're ok"
> >     def ok(self):
> >         if check_authentication():
> >             return
> >         else:
> >             pass ## exit without returning here!
>
> > I tried doing web.seeother to send them to an error page, but it seems
> > like it continues to execute the rest of the code (which it probably
> > should in that case.)
>
> > It seems like a pretty reasonable thing to do. Otherwise I have to add
> > all these bogus returns and exit handling for them.
>
> --
> Sent from Gmail for mobile | mobile.google.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to