def listImages(): global image_dir image_index = 0 # Since image_list is declared globally, empty it before populating global image_list del image_list[:] global image_db del image_db [:] # Create the DB. FIXME: This needs to be called from runserver.py # before calling run. That seems to have some issues. So calling from # here for now. Need to fix it. session = bcaw_db.bcawdb() for img in os.listdir(image_dir): if img.endswith(".E01") or img.endswith(".AFF"): #print img global image_list image_list.append(img) dm = bcaw() image_path = image_dir+'/'+img dm.num_partitions = dm.bcawGetPartInfoForImage(image_path, image_index) idb = bcaw_db.DimacImages.query.filter_by(image_name=img).first() image_db.append(idb) ## print("D: IDB: image_index:{}, image_name:{}, acq_date:{}, md5: {}".format(image_index, idb.image_name, idb.acq_date, idb.md5)) image_index +=1 else: continue # Render the template for main page. #print 'D: Image_list: ', image_list global num_images num_images = len(image_list) return image_list
break offset += len(data) total_data = total_data+data #print "Length OF TOTAL DATA: ", len(total_data) mime = MimeTypes() mime_type, a = mime.guess_type(file_name) generator = (cell for row in total_data for cell in row) return Response(stream_with_context(generator), mimetype=mime_type, headers={"Content-Disposition": "attachment;filename=" + urllib.quote(file_name) }) #"attachment;filename=" + file_name }) ''' return render_template('fl_filecat_temp_ext.html', image_name=str(image_name), partition_num=image_partition, file_name=file_name, contents=str(data)) #contents = data.decode("utf-8")) ''' # FIXME: This is never called (since we run runserver.py) # Remove once confirmed to be deleted if __name__ == "__main__": dm = bcaw() bcaw_db.bcawdb() app.run()