From c64fea7746c0cb75541bc391e34e68cc91a2b24a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 29 Jul 2019 13:07:09 -0700 Subject: [PATCH] backups: Fix issue with showing index page Fix an exception when loading backups page: Exception Value: 'functools.partial' object has no attribute '__name__' Exception Location: /vagrant/plinth/modules/backups/decorators.py in delete_tmp_backup_file, line 38 Signed-off-by: Sunil Mohan Adapa --- plinth/modules/backups/decorators.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plinth/modules/backups/decorators.py b/plinth/modules/backups/decorators.py index b8cd92270..ffa756f4d 100644 --- a/plinth/modules/backups/decorators.py +++ b/plinth/modules/backups/decorators.py @@ -18,15 +18,21 @@ Decorators for the backup views. """ +import functools import os from . import SESSION_PATH_VARIABLE def delete_tmp_backup_file(function): - """Decorator to delete uploaded backup files""" + """Decorator to delete uploaded backup files. - def wrap(request, *args, **kwargs): + XXX: Implement a better way to delete uploaded files. + + """ + + @functools.wraps(function) + def wrapper(request, *args, **kwargs): path = request.session.get(SESSION_PATH_VARIABLE, None) if path: if os.path.isfile(path): @@ -34,7 +40,4 @@ def delete_tmp_backup_file(function): del request.session[SESSION_PATH_VARIABLE] return function(request, *args, **kwargs) - wrap.__doc__ = function.__doc__ - wrap.__name__ = function.__name__ - - return wrap + return wrapper