On 8/16/07, Gerardo Herzig <[EMAIL PROTECTED]> wrote: > @is_logued_in > def change_pass(): > bla > bla > > And so on for all the other functions who needs that the user is still > loged in. > > where obviosly the is_logued_in() function will determine if the dude is > still loged in, and THEN execute change_pass(). If the dude is not loged > in, change_pass() is NOT executed at all. Instead, it will be redirected > to the `login' screen.
I think this is redundant use of a decorator. You can achieve the exact same effect by writing: def is_logued_in(): if not user.is_logged_in(): raise NotLoggedInError It costs you one more line, but reduces complexity. And if you are worried about that extra line you can put it in a function. -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list