Ejemplo n.º 1
0
 def do(self, seq, doc):
     js, prs, ret = seq
     d = gd.Doc()
     d['inp'] = doc
     d['prs'] = prs
     d['ret'] = ret
     for i in range(len(js)):
         d['j%i' % i] = js[i].todoc()
     r = self.put('/seq', jobs.d2str(d), 'application/zip',
                  {'Accept': 'application/zip'})
     try:
         return jobs.str2d(r)
     except:
         print(r)
Ejemplo n.º 2
0
 def collect(self, ret, delete, pref='j'):
     d = gd.Doc()
     for i, id in enumerate(ret):
         di = self.get('/doc/%i' % id, ctype=jobs.CTYPE)
         try:
             di = jobs.str2d(di)
         except:
             raise ValueError('No document in response %s' % di)
         d['%s%i' % (pref, i)] = di
     if delete:
         url = "/doc?" + "&".join(["id=%i" % i for i in delete])
         z = self.delete(url)
         if not self.isok(z):
             report("WARNING: delete failed: %s" % z)
     return d