Handle error from upload definition command

Partially closes bug: #1322421

Change-Id: I67a525856fa2b80a7f9624b448352b0438141a98
This commit is contained in:
Nikolay Mahotkin
2014-05-23 17:01:49 +04:00
parent 762e1cdc3c
commit c35bb16b8b

View File

@@ -62,12 +62,19 @@ class WorkbookManager(base.ResourceManager):
def upload_definition(self, name, text):
self._ensure_not_empty(name=name)
self.client.http_client.put('/workbooks/%s/definition' % name,
text,
headers={'content-type': 'text/plain'})
resp = self.client.http_client.put('/workbooks/%s/definition' % name,
text,
headers={'content-type':
'text/plain'})
if resp.status_code != 200:
self._raise_api_exception(resp)
def get_definition(self, name):
self._ensure_not_empty(name=name)
return self.client.http_client.get('/workbooks/%s/definition'
% name).content
resp = self.client.http_client.get('/workbooks/%s/definition'
% name)
if resp.status_code != 200:
self._raise_api_exception(resp)
return resp.content