[apycotlib] mirror changes in narval 4 for file-upload
authorPaul Tonelli <paul.tonelli@logilab.fr>
Tue, 01 Apr 2014 16:14:34 +0200
changeset 1480 7d22bbad8323
parent 1479 cd9504d6fa16
child 1481 1fd3dead3573
[apycotlib] mirror changes in narval 4 for file-upload - rename of 'field' to 'r(elation)name' - rename of 'log' to 'data'
_apycotlib/writer.py
--- a/_apycotlib/writer.py	Tue Apr 01 16:13:17 2014 +0200
+++ b/_apycotlib/writer.py	Tue Apr 01 16:14:34 2014 +0200
@@ -148,11 +148,11 @@
     def refresh_log(self):
         log = self._logs
         if self._logs_sent < len(log):
-            files = {'log': ('file', u'\n'.join(log[self._logs_sent:]) + '\n' )}
+            files = {'data': ('log_file.txt', u'\n'.join(log[self._logs_sent:]) + '\n' )}
             self.cnxh.http_post(self.instance_url() +
                     'file-upload',
+                    rname='log_file',
                     files=files,
-                    field='log_file',
                     eid=self.target_eid()
                     )
             self._logs_sent = len(log)
@@ -217,11 +217,11 @@
             try:
                 tarball.add(archivedir)
                 tarball.close()
-                files = {'log': (archive, StringIO(open(archivefpath,
+                files = {'data': (archive, StringIO(open(archivefpath,
                                  'rb').read()))}
                 self.cnxh.http_post(self.instance_url() + 'file-upload',
                                      files=files,
-                                     field='execution_archive',
+                                     rname='execution_archive',
                                      eid=self.target_eid())
             except:
                 self.error('while archiving execution directory', tb=True)