mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
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:
parent
caf1e4b0bd
commit
c64fea7746
@ -18,15 +18,21 @@
|
|||||||
Decorators for the backup views.
|
Decorators for the backup views.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import functools
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from . import SESSION_PATH_VARIABLE
|
from . import SESSION_PATH_VARIABLE
|
||||||
|
|
||||||
|
|
||||||
def delete_tmp_backup_file(function):
|
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)
|
path = request.session.get(SESSION_PATH_VARIABLE, None)
|
||||||
if path:
|
if path:
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
@ -34,7 +40,4 @@ def delete_tmp_backup_file(function):
|
|||||||
del request.session[SESSION_PATH_VARIABLE]
|
del request.session[SESSION_PATH_VARIABLE]
|
||||||
return function(request, *args, **kwargs)
|
return function(request, *args, **kwargs)
|
||||||
|
|
||||||
wrap.__doc__ = function.__doc__
|
return wrapper
|
||||||
wrap.__name__ = function.__name__
|
|
||||||
|
|
||||||
return wrap
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user