def post_zipfile(self, filename): f = open(filename, "rb") content_type, data = get_multipart('collection.zip', f.read(), 'collection') f.close() log.info('POSTing zipfile %r to %s (%d Bytes)' % (filename, self.posturl, len(data))) self._post(data, content_type=content_type)
post_status('packaging') if not options.noimages: z.writeImages(size=imagesize) post_progress(80) z.writeContent() zf.close() post_progress(90) if posturl: post_status('uploading') zf = open(zipfilename, "rb") ct, data = get_multipart('collection.zip', zf.read(), 'collection') zf.close() req = urllib2.Request(posturl, data=data, headers={"Content-Type": ct}) result = urllib2.urlopen(req).read() if w['images']: w['images'].clear() if not output: os.unlink(zipfilename) post_status('finished') post_progress(100) except Exception, e:
post_status('packaging') if not options.noimages: z.writeImages(size=imagesize) post_progress(80) z.writeContent() zf.close() post_progress(90) if posturl: post_status('uploading') zf = open(zipfilename, "rb") ct, data = get_multipart('collection.zip', zf.read(), 'collection') zf.close() req = urllib2.Request(posturl, data=data, headers={"Content-Type": ct}) result = urllib2.urlopen(req).read() if w['images']: w['images'].clear() if not output: os.unlink(zipfilename) post_status('finished') post_progress(100) except Exception, e: post_status('error') raise