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 <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2019-07-29 13:07:09 -07:00
parent caf1e4b0bd
commit c64fea7746
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

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