def checkOutputFileExtensions(self): """Checks if the values of outputs are correct and have one of the supported output extensions. If not, it adds the first one of the supported extensions, which is assumed to be the default one. """ for out in self.outputs: if not out.hidden and out.value is not None: if not os.path.isabs(out.value): continue if isinstance(out, OutputRaster): exts = \ dataobjects.getSupportedOutputRasterLayerExtensions() elif isinstance(out, OutputVector): exts = \ dataobjects.getSupportedOutputVectorLayerExtensions() elif isinstance(out, OutputTable): exts = dataobjects.getSupportedOutputTableExtensions() elif isinstance(out, OutputHTML): exts = ['html', 'htm'] else: continue idx = out.value.rfind('.') if idx == -1: out.value = out.value + '.' + exts[0] else: ext = out.value[idx + 1:] if ext not in exts: out.value = out.value + '.' + exts[0]
def checkOutputFileExtensions(self): """Checks if the values of outputs are correct and have one of the supported output extensions. If not, it adds the first one of the supported extensions, which is assumed to be the default one. """ for out in self.outputs: if not out.hidden and out.value is not None: if not os.path.isabs(out.value): continue if isinstance(out, OutputRaster): exts = dataobjects.getSupportedOutputRasterLayerExtensions() elif isinstance(out, OutputVector): exts = dataobjects.getSupportedOutputVectorLayerExtensions() elif isinstance(out, OutputTable): exts = dataobjects.getSupportedOutputTableExtensions() elif isinstance(out, OutputHTML): exts = ["html", "htm"] else: continue idx = out.value.rfind(".") if idx == -1: out.value = out.value + "." + exts[0] else: ext = out.value[idx + 1 :] if ext not in exts: out.value = out.value + "." + exts[0]