[apycotlib] improve calls to http_get /post when communicating with cubicweb:
authorPaul Tonelli <paul.tonelli@logilab.fr>
Mon, 24 Mar 2014 10:17:06 +0100
changeset 1475 2a7c0ab3f126
parent 1474 d7529125ba8a
child 1476 419c81116273
[apycotlib] improve calls to http_get /post when communicating with cubicweb: - use get to get information from the cubicweb instance - use post to send information to modify the cubicweb instance - do not use object cwuri but concatenate cnxh url with eid
_apycotlib/atest.py
_apycotlib/narvalactions.py
_apycotlib/writer.py
--- a/_apycotlib/atest.py	Tue Dec 17 11:13:04 2013 +0100
+++ b/_apycotlib/atest.py	Mon Mar 24 10:17:06 2014 +0100
@@ -112,9 +112,10 @@
         try:
             return self._configs[pe['eid']]
         except KeyError:
-            config = self.writer._cnxh.http_post(self.tconfig['cwuri'],
-                                                 vid='apycot.get_configuration',
-                                                 environment=pe['eid'])[0]
+            tconfig_url = self.writer._cnxh.instance_url + str(self.tconfig['eid'])
+            config = self.writer._cnxh.http_get(tconfig_url,
+                                                vid='apycot.get_configuration',
+                                                environment=pe['eid'])[0]
             self._configs[pe['eid']] = config
             self._substitute(pe, config)
             return config
--- a/_apycotlib/narvalactions.py	Tue Dec 17 11:13:04 2013 +0100
+++ b/_apycotlib/narvalactions.py	Mon Mar 24 10:17:06 2014 +0100
@@ -16,9 +16,9 @@
             self.test.global_status = ERROR
         self.test.clean()
 
-
 def install_environment(test):
-    data = test.writer._cnxh.http_post(test.texec['cwuri'], vid='apycot.get_dependencies')
+    texec_url = test.writer._cnxh.instance_url + str(test.texec['eid'])
+    data = test.writer._cnxh.http_get(texec_url, vid='apycot.get_dependencies')
     for dep in data[0]:
         test.checkout(dep)
         test.call_preprocessor('install', dep)
--- a/_apycotlib/writer.py	Tue Dec 17 11:13:04 2013 +0100
+++ b/_apycotlib/writer.py	Mon Mar 24 10:17:06 2014 +0100
@@ -172,7 +172,7 @@
                                     __cwrel__='during_execution',
                                     name=self._unicode(crname), status=u'processing',
                                     starttime=datetime.now())
-        self._url = data[0]['cwuri']
+        self._url = self._cnxh.instance_url + str(data[0]['eid'])
         if hasattr(checker, 'options'):
             options = ['%s=%s' % (k, v) for k, v in checker.options.iteritems()
                        if k in checker.options_def