Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tutorius
diff options
context:
space:
mode:
authorBen Tremblay <benoit.tremblay1@gmail.com>2009-11-05 19:53:51 (GMT)
committer Ben Tremblay <benoit.tremblay1@gmail.com>2009-11-05 19:53:51 (GMT)
commit4b292b46acb6ecf08fbfe980cefaaeba51199aab (patch)
tree1856aeb8f359c7d540c83e40471fd092bbda70f2 /tutorius
parentd50c3cd98d6e99c7311286559136dc1a775a326d (diff)
publish now returns the newly published tutorial id
Diffstat (limited to 'tutorius')
-rw-r--r--tutorius/store.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/tutorius/store.py b/tutorius/store.py
index 81925ed..d9ea3ea 100644
--- a/tutorius/store.py
+++ b/tutorius/store.py
@@ -323,11 +323,11 @@ 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 False
+ return -1
- return True
+ return tutorial_store_id
# Otherwise, we want to publish a new tutorial
if tutorial_info == None:
@@ -338,11 +338,17 @@ 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 False
+ return -1
+
+ xml_response = minidom.parseString(response['body'])
+
+ id_node = xml_response.getElementsByTagName("id")[0]
+
+ id = id_node.getAttribute('value')
- return True
+ return id
def unpublish(self, tutorial_store_id):