Skip to content
Permalink
Browse files
[Processing] Fix specific exception type in getParameterFromString
  • Loading branch information
rldhont authored and nyalldawson committed May 20, 2021
1 parent ef05b76 commit b9067d9400b36df649c3ea59574dc6dfc7f49802
Showing with 10 additions and 10 deletions.
  1. +10 −10 python/plugins/processing/core/parameters.py
@@ -116,7 +116,7 @@ def getParameterFromString(s, context=''):
if len(params) > 2:
try:
params[2] = [int(p) for p in params[2].split(';')]
except:
except ValueError:
params[2] = [getattr(QgsProcessing, p.split(".")[1]) for p in params[2].split(';')]
if len(params) > 4:
params[4] = True if params[4].lower() == 'true' else False
@@ -125,7 +125,7 @@ def getParameterFromString(s, context=''):
params[3] = True if params[3].lower() == 'true' else False
try:
params[4] = [int(p) for p in params[4].split(';')]
except:
except ValueError:
params[4] = [getattr(QgsProcessing, p.split(".")[1]) for p in params[4].split(';')]
elif clazz == QgsProcessingParameterBoolean:
if len(params) > 2:
@@ -141,7 +141,7 @@ def getParameterFromString(s, context=''):
if len(params) > 4:
try:
params[4] = [int(p) for p in params[4].split(';')]
except:
except ValueError:
params[4] = [getattr(QgsWkbTypes, p.split(".")[1]) for p in params[4].split(';')]
if len(params) > 5:
params[5] = True if params[5].lower() == 'true' else False
@@ -152,7 +152,7 @@ def getParameterFromString(s, context=''):
if len(params) > 2:
try:
params[2] = int(params[2])
except:
except ValueError:
params[2] = getattr(QgsProcessingParameterNumber, params[2].split(".")[1])
if len(params) > 4:
params[4] = True if params[4].lower() == 'true' else False
@@ -179,15 +179,15 @@ def getParameterFromString(s, context=''):
if len(params) > 2:
try:
params[2] = [int(p) for p in params[2].split(';')]
except:
except ValueError:
params[2] = [getattr(QgsProcessing, p.split(".")[1]) for p in params[2].split(';')]
if len(params) > 4:
params[4] = True if params[4].lower() == 'true' else False
elif clazz == QgsProcessingParameterMultipleLayers:
if len(params) > 2:
try:
params[2] = int(params[2])
except:
except ValueError:
params[2] = getattr(QgsProcessing, params[2].split(".")[1])
if len(params) > 4:
params[4] = True if params[4].lower() == 'true' else False
@@ -204,7 +204,7 @@ def getParameterFromString(s, context=''):
if len(params) > 4:
try:
params[4] = int(params[4])
except:
except ValueError:
params[4] = getattr(QgsProcessingParameterField, params[4].split(".")[1])
if len(params) > 5:
params[5] = True if params[5].lower() == 'true' else False
@@ -216,15 +216,15 @@ def getParameterFromString(s, context=''):
if len(params) > 2:
try:
params[2] = int(params[2])
except:
except ValueError:
params[2] = getattr(QgsProcessingParameterFile, params[2].split(".")[1])
if len(params) > 5:
params[5] = True if params[5].lower() == 'true' else False
elif clazz == QgsProcessingParameterNumber:
if len(params) > 2:
try:
params[2] = int(params[2])
except:
except ValueError:
params[2] = getattr(QgsProcessingParameterNumber, params[2].split(".")[1])
if len(params) > 3:
params[3] = float(params[3].strip()) if params[3] is not None else None
@@ -263,7 +263,7 @@ def getParameterFromString(s, context=''):
if len(params) > 2:
try:
params[2] = int(params[2])
except:
except ValueError:
params[2] = getattr(QgsProcessing, params[2].split(".")[1])
if len(params) > 4:
params[4] = True if params[4].lower() == 'true' else False

0 comments on commit b9067d9

Please sign in to comment.