From: Maciej Tronowski Date: Wed, 22 Apr 2015 14:19:55 +0000 (+0200) Subject: gridftp: multiple fixes in handling and presenting errors X-Git-Tag: v1.0~47 X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=commitdiff_plain;ds=sidebyside;h=0be92069d46130aad675fa715184e9c209140ce9;hp=107c44b051e4523ce86b65c6d1d5ff26dd0c13e6;p=qcg-portal.git gridftp: multiple fixes in handling and presenting errors --- diff --git a/filex/ftp.py b/filex/ftp.py index 2c92f12..d83a55c 100644 --- a/filex/ftp.py +++ b/filex/ftp.py @@ -99,13 +99,14 @@ class FTPOperation: for attr in attrs.split(';'): try: key, value = attr.split('=', 1) - attrs_dict[key] = value except ValueError: - pass + key, value = attr, '' + + attrs_dict[key] = value yield { 'name': name, - 'type': 'directory' if attrs_dict['Type'] == 'dir' else 'file', + 'type': 'directory' if attrs_dict['Type'].endswith('dir') else 'file', 'size': int(attrs_dict['Size']), 'date': localtime(datetime.strptime(attrs_dict['Modify'], "%Y%m%d%H%M%S").replace(tzinfo=UTC())), } diff --git a/filex/static/filex/filex.js b/filex/static/filex/filex.js index eb71ee4..26bec82 100644 --- a/filex/static/filex/filex.js +++ b/filex/static/filex/filex.js @@ -284,9 +284,20 @@ $(function(){ $this.modal('hide'); $btn.button('reset'); - }, 'json').fail(function() { + }, 'json').fail(function(xhr) { console.error(arguments); - $btn.button('error'); + var error = (xhr.responseJSON || {}).error || undefined; + + if (typeof error === 'string') { + $('
', { + 'class': 'alert alert-danger', + html: ' ' + error + }).prependTo($this.find('.modal-body')); + $btn.button('reset'); + } + else { + $btn.button('error'); + } }); }); diff --git a/filex/templates/filex/source.html b/filex/templates/filex/source.html index ba88414..551ae51 100644 --- a/filex/templates/filex/source.html +++ b/filex/templates/filex/source.html @@ -75,7 +75,7 @@
diff --git a/filex/templates/filex/upload.html b/filex/templates/filex/upload.html index 346fc1d..b79d9c0 100644 --- a/filex/templates/filex/upload.html +++ b/filex/templates/filex/upload.html @@ -3,43 +3,51 @@

Lokalizacja: {{ host }}{{ sep }}{{ path }}

- - -
- -
Upuść pliki tutaj
- - +{% else %} + -