Fix bad parsing of HTTP response

Fix bad parsing of HTTP response, on exception.

Change-Id: I7457ab3e1321dcc9511a090e982e53af48f0a0e7
Closes-Bug: #1642865
This commit is contained in:
David TARDIVEL 2017-01-16 12:03:23 +01:00
parent 1292a016e0
commit 023f5487c5
2 changed files with 3 additions and 3 deletions

View File

@ -131,7 +131,7 @@ class CreateForm(forms.SelfHandlingForm):
messages.success(request, message)
return audit_tpl
except Exception as exc:
msg = _('Failed to create audit template"%s".') % data['name']
msg = _('Failed to create audit template.')
LOG.info(exc)
redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect)

View File

@ -97,10 +97,10 @@ class CreateForm(forms.SelfHandlingForm):
messages.success(request, message)
return audit
except Exception as exc:
if exc.status_code == 409:
if exc.http_status == 409:
msg = _('Quota exceeded for resource audit.')
else:
msg = _('Failed to create audit "%s".') % data['name']
msg = _('Failed to create audit.')
LOG.info(exc)
redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect)