The function returned by the decorator will be called as if it were
the decorated function.  If the variable you seek is already one of
the parameters sent to that function, or is derivable from them, then
you're all set.  If not, you'll need to add that variable to the
original function call.  If the decorated function can't accept it,
then the decorator will need to strip it from the parameters before
calling the decorated function.  Yes, that makes the call look odd,
but it works.

For more details, read a tutorial on decorators, or provide the call
signatures of the authorization function and the function to be
decorated.

- Eric

On Tue, Aug 19, 2014 at 9:05 PM, Daniel <[email protected]> wrote:
> Hello group,
>
> I have a flask application I am writing. I need to know how to pass a
> variable to the decorator of a function. The decorator will determine if a
> user is authorized to view a page. The variable I would use would have the
> user id and role. Can anyone help with this?
>
> Daniel Taualii
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to