def get(self): id = self.request.get('id', None) test = self.request.get('test', None) report = ReportModel.get_by_id(int(id)) # create the zip stream zipstream = StringIO() file = zipfile.ZipFile(zipstream, "w") file.filename = str('log-id%s-%s.zip' % (id, report.date.strftime('%Y-%m-%d %H-%M-%S'))) for blobKey in report.blobKeys: meta = blobstore.BlobInfo.get(blobKey) data = blobstore.BlobReader(blobKey).read() if test: self.response.out.write('<b>%s</b><br/>' % meta.filename) else: file.writestr(str(meta.filename), data) if test: return # we have finished with the zip so package it up and write the directory file.close() zipstream.seek(0) # create and return the output stream self.response.headers['Content-Type'] ='application/zip' self.response.headers['Content-Disposition'] = 'attachment; filename="%s"' % file.filename while True: buf = zipstream.read(10240) if buf == "": break self.response.out.write(buf)
def get(self): id = self.request.get('id', None) report = ReportModel.get_by_id(int(id)) reproSteps = None reporterVersion = None if report.userProps: reportMetaBlobData = blobstore.BlobReader(report.userProps).read() reportMetaPlist = plistlib.readPlistFromString(reportMetaBlobData) reproSteps = reportMetaPlist.get('ReproSteps', None) reporterVersion = reportMetaPlist.get('ReporterVersion', None) template_values = { 'id': id, 'header': "Report %u (%s)" % (int(id), report.date.strftime('%Y-%m-%d %H:%M:%S')), 'repro': reproSteps, 'reporterVersion': reporterVersion, 'comment': report.comment, } path = os.path.join(os.path.dirname(__file__), 'templates', 'manage_view.html') self.response.out.write(template.render(path, template_values))
def post(self): comment = self.request.get('comment', None) id = self.request.get('id', None) report = ReportModel.get_by_id(int(id)) report.comment = comment report.put() self.redirect('view?id=%u' % report.key().id())
def get(self): id = self.request.get('id', None) test = self.request.get('test', None) report = ReportModel.get_by_id(int(id)) # create the zip stream zipstream = StringIO() file = zipfile.ZipFile(zipstream, "w") file.filename = str('log-id%s-%s.zip' % (id, report.date.strftime('%Y-%m-%d %H-%M-%S'))) for blobKey in report.blobKeys: meta = blobstore.BlobInfo.get(blobKey) data = blobstore.BlobReader(blobKey).read() if test: self.response.out.write('<b>%s</b><br/>' % meta.filename) else: file.writestr(str(meta.filename), data) if test: return # we have finished with the zip so package it up and write the directory file.close() zipstream.seek(0) # create and return the output stream self.response.headers['Content-Type'] = 'application/zip' self.response.headers[ 'Content-Disposition'] = 'attachment; filename="%s"' % file.filename while True: buf = zipstream.read(10240) if buf == "": break self.response.out.write(buf)