Make GPG key import errors more verbose
This commit is contained in:
@@ -341,4 +341,4 @@ class GPG(object):
|
|||||||
if import_result:
|
if import_result:
|
||||||
return Key.get(self, import_result.fingerprints[0], secret=False)
|
return Key.get(self, import_result.fingerprints[0], secret=False)
|
||||||
|
|
||||||
raise KeyImportError
|
raise KeyImportError(import_result.results[0].get('text', 'Unknown error'))
|
||||||
|
|||||||
@@ -37,8 +37,15 @@ def key_receive(request, key_id):
|
|||||||
key = gpg.import_key(keys_dict[key_id].key)
|
key = gpg.import_key(keys_dict[key_id].key)
|
||||||
messages.success(request, _(u'Key: %s, imported successfully.') % key)
|
messages.success(request, _(u'Key: %s, imported successfully.') % key)
|
||||||
return HttpResponseRedirect(next)
|
return HttpResponseRedirect(next)
|
||||||
except (KeyImportError, KeyError, TypeError):
|
except (KeyImportError, KeyError, TypeError), e:
|
||||||
messages.error(request, _(u'Unable to import key id: %s') % key_id)
|
messages.error(
|
||||||
|
request,
|
||||||
|
_(u'Unable to import key id: %(key_id)s; %(error)s') %
|
||||||
|
{
|
||||||
|
'key_id': key_id,
|
||||||
|
'error': e,
|
||||||
|
}
|
||||||
|
)
|
||||||
return HttpResponseRedirect(previous)
|
return HttpResponseRedirect(previous)
|
||||||
|
|
||||||
return render_to_response('generic_confirm.html', {
|
return render_to_response('generic_confirm.html', {
|
||||||
|
|||||||
Reference in New Issue
Block a user