diff options
Diffstat (limited to 'tutorius/store.py')
-rw-r--r-- | tutorius/store.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tutorius/store.py b/tutorius/store.py index 760daec..2e55d71 100644 --- a/tutorius/store.py +++ b/tutorius/store.py @@ -323,6 +323,10 @@ class StoreProxy(object): headers = { 'X-API-Auth' : self.api_auth_key } response = self.conn.request_post(request_url, None, None, None, headers) + if self.helper.iserror(response): + return -1 + + return tutorial_store_id if self.helper.iserror(response): return False @@ -338,12 +342,22 @@ class StoreProxy(object): headers = { 'X-API-Auth' : self.api_auth_key } response = self.conn.request_post(request_url, tutorial_info, tutorial, tutorial_info['filename'], headers) + + if self.helper.iserror(response): + return -1 + + xml_response = minidom.parseString(response['body']) + + id_node = xml_response.getElementsByTagName("id")[0] + + id = id_node.getAttribute('value') + + return id if self.helper.iserror(response): return False return True - def unpublish(self, tutorial_store_id): """ @@ -470,4 +484,4 @@ class StoreProxyHelper(object): else: tutorial[param] = '' - return tutorial
\ No newline at end of file + return tutorial |