#2112: [Patch] Allow overriding @require error handling
-------------------------+--------------------------------------------------
Reporter: vinces1979 | Owner: faide
Type: enhancement | Status: new
Priority: normal | Milestone: 2.0b1
Component: TurboGears | Version: trunk
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
The default @require redirects can cause issues in non html applications.
(Ex: flex applications)
Example Usage (this will raise a Flex ErrorMessage):
{{{
class AuthFailed(remoting.RemotingError):
pass
add_error_class(AuthFailed, "Auth.Failed")
def flexError(reason):
msg = remoting.ErrorFault()
msg.description = reason
msg.code = "Auth.Failed"
msg.level = "error"
return msg.raiseException()
class FlexController:
@require(authorize.not_anonymous("NOT AUTHED"), flexError)
def echo(self, data):
user = ""
if request.identity:
user = request.identity['user'].display_name
log.debug("USER: %s" % user)
return "Turbogears gateway says: %s %s" % (data, user)
}}}
--
Ticket URL: <http://trac.turbogears.org/ticket/2112>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---