mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
actions: Allow privileged methods to be decorated again
- So that we write decorators that can handle errors as needed by backups app. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
3a0db947b2
commit
9b29ea960f
@ -383,7 +383,14 @@ def _privileged_call(module_name, action_name, arguments):
|
||||
if not getattr(action, '_privileged', None):
|
||||
raise SyntaxError('Specified action is not privileged action')
|
||||
|
||||
func = getattr(action, '__wrapped__')
|
||||
# Get the original function that may have been wrapped/decorated multiple
|
||||
# times
|
||||
func = action
|
||||
while True:
|
||||
try:
|
||||
func = getattr(func, '__wrapped__')
|
||||
except AttributeError:
|
||||
break
|
||||
|
||||
_privileged_assert_valid_arguments(func, arguments)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user