Fix the file manager when used under Python 3. Fixes #1872
Issues fixed: 1) In Python 3, parameter "cmp" is removed from sorted method. So File Manager won't open. As we are sorting data on JS side using Natural sort, so on server side sorting is not required. 2) Improvement in Exception handling.pull/3/head
parent
d29ccea299
commit
d806a9ce9e
|
@ -441,11 +441,7 @@ class Filemanager(object):
|
|||
|
||||
orig_path = unquote(orig_path)
|
||||
try:
|
||||
def custom_sort(x, y):
|
||||
return y.lower() > x.lower()
|
||||
|
||||
mylist = [x for x in sorted(os.listdir(orig_path),
|
||||
cmp=custom_sort)]
|
||||
mylist = [x for x in sorted(os.listdir(orig_path))]
|
||||
for f in mylist:
|
||||
protected = 0
|
||||
system_path = os.path.join(os.path.join(orig_path, f))
|
||||
|
@ -491,10 +487,11 @@ class Filemanager(object):
|
|||
}
|
||||
}
|
||||
except Exception as e:
|
||||
if e.strerror == gettext('Permission denied'):
|
||||
if (hasattr(e, 'strerror') and
|
||||
e.strerror == gettext('Permission denied')):
|
||||
err_msg = "Error: {0}".format(e.strerror)
|
||||
else:
|
||||
err_msg = "Error: {0}".format(e.strerror)
|
||||
err_msg = "Error: {0}".format(e)
|
||||
files = {
|
||||
'Code': 0,
|
||||
'err_msg': err_msg
|
||||
|
|
Loading…
Reference in New Issue