def populate_obj(self, obj, name): field = getattr(obj, name) bbox = self.form.bbox.data or None filename = self.form.filename.data or None if filename and filename in tmp: with tmp.open(filename) as infile: field.save(infile, filename, bbox=bbox) tmp.delete(filename)
def populate_obj(self, obj, name): field = getattr(obj, name) bbox = self.form.bbox.data or None filename = self.form.filename.data or None if filename and filename in tmp: with tmp.open(filename, 'rb') as infile: field.save(infile, filename, bbox=bbox) tmp.delete(filename)
def cleanup(prefix): log.info('Removing temporary files') tmp.delete(prefix) if tmp.exists(GEOZONE_FILENAME): # Has been downloaded tmp.delete(GEOZONE_FILENAME)