Python: Further fix of consequent errors.
This commit is contained in:
parent
3a4e05bd5c
commit
8ef7685d0f
1 changed files with 5 additions and 6 deletions
11
fasi.py
11
fasi.py
|
@ -319,7 +319,7 @@ class HttpInstance:
|
||||||
jid_bare, jid_info, jid_kind, node_name, item_id)
|
jid_bare, jid_info, jid_kind, node_name, item_id)
|
||||||
|
|
||||||
# Graphic files
|
# Graphic files
|
||||||
filename, filepath, filetype, selection = FileUtilities.handle_photo(jid_bare, jid_vcard)
|
filename, filepath, filetype, selection = FileUtilities.handle_photo(jid_bare, jid_vcard, link_href)
|
||||||
|
|
||||||
#except Exception as e:
|
#except Exception as e:
|
||||||
else:
|
else:
|
||||||
|
@ -550,7 +550,7 @@ class HttpInstance:
|
||||||
jid_bare, jid_info, jid_kind, node_name)
|
jid_bare, jid_info, jid_kind, node_name)
|
||||||
|
|
||||||
# Graphic files
|
# Graphic files
|
||||||
filename, filepath, filetype, selection = FileUtilities.handle_photo(jid_bare, jid_vcard)
|
filename, filepath, filetype, selection = FileUtilities.handle_photo(jid_bare, jid_vcard, link_href)
|
||||||
|
|
||||||
#except Exception as e:
|
#except Exception as e:
|
||||||
else:
|
else:
|
||||||
|
@ -835,15 +835,14 @@ class FileUtilities:
|
||||||
return jid_details
|
return jid_details
|
||||||
|
|
||||||
def handle_photo(jid_bare, jid_vcard, link_href):
|
def handle_photo(jid_bare, jid_vcard, link_href):
|
||||||
filetype = selection = None
|
filename = filepath = filetype = mimetype = selection = None
|
||||||
filecirca = 'photo/{}.*'.format(jid_bare)
|
filecirca = 'photo/{}.*'.format(jid_bare)
|
||||||
filepath_guess = glob.glob(filecirca)
|
filepath_guess = glob.glob(filecirca)
|
||||||
if filepath_guess:
|
if filepath_guess:
|
||||||
filepath_guess = filepath_guess[0]
|
filepath = filepath_guess[0]
|
||||||
filetype = filepath_guess.split('.').pop()
|
filetype = filepath.split('.').pop()
|
||||||
filename = '{}.{}'.format(jid_bare, filetype)
|
filename = '{}.{}'.format(jid_bare, filetype)
|
||||||
elif jid_vcard:
|
elif jid_vcard:
|
||||||
mimetype = filename = filepath = None
|
|
||||||
if jid_vcard['type']:
|
if jid_vcard['type']:
|
||||||
mimetype = jid_vcard['type']
|
mimetype = jid_vcard['type']
|
||||||
if mimetype:
|
if mimetype:
|
||||||
|
|
Loading…
Reference in a new issue