Might be a naive AJAX question.

While learning AJAX, I see that @identity.require is not redirecting
to the login page in case of AJAX calls. In stead, the call just
fails. Might be this is the natural behavior for AJAX calls. I suppose
@error_handler and @exception_handler might not be working as well for
AJAX calls.

The raw way to handle these scenarios as it strikes me is like this:

@expose("json")
def some_controller_method(self):
     if not logged in:
          return {"error": "Not logged in"}

     validate the inputs
     if validation error:
         return {respective errors}

     try:
         process()
     except:
         return {respective error}


Suggestions on better ways to handle these scenarios will be of vital
help.

thanks,
Sanjay

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to