Strictly speaking order can be arbitrary, however all permutations are 
not invariants.
One needs to take into consideration validate and require can alter 
program flow (for invalid inputs). Depending on this branching it is 
possible to construct a situation wherein some permutations are faster 
than others.
Any such optimisations are far from self-explanatory and should, if 
used, be well documented (or even included into project's coding standard).

The "standard" order is expose, require, validate, error_handler, 
exception_handler.

Some care should be taken with error_handler when used in explicit 
"recursive fashion" (method being it's own handler). Writing something like:

@expose
@validate
@require
@error_handler(None)
def ...

can lead to a nasty security hole, as for any invalid input require() 
will be by-passed.
I am working on improving this behaviour, suggestions are welcomed.


Cheers,
Simon


gergo wrote:
> Hi,
> 
> is there any effect on the program (speed?) of the order of a
> function's decorators?
> What is the recommended order of expose, identity.require, validate,
> error_handler?
> 
> Gergely MAJOR
> 
> 
> 
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to