Skip to content
Permalink
Browse files

[processing] fix handling of optional string arguments (fix #9109, 9120)

  • Loading branch information
alexbruy committed Mar 26, 2014
1 parent 92ee039 commit 024f6a12f373abbbc28e4ed432278324ce474424
@@ -60,7 +60,7 @@ def defineCharacteristics(self):
'none'))
self.addParameter(ParameterExtent(self.PROJWIN, 'Clipping extent'))
self.addParameter(ParameterString(self.EXTRA,
'Additional creation parameters', ''))
'Additional creation parameters', '', optional=True))
self.addOutput(OutputRaster(self.OUTPUT, 'Output layer'))

def processAlgorithm(self, progress):
@@ -70,7 +70,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterBoolean(self.KEEP_RESOLUTION,
'Keep resolution of output raster', False))
self.addParameter(ParameterString(self.EXTRA,
'Additional creation parameters', ''))
'Additional creation parameters', '', optional=True))
self.addOutput(OutputRaster(self.OUTPUT, 'Output layer'))

def processAlgorithm(self, progress):
@@ -64,7 +64,7 @@ def defineCharacteristics(self):
'Attribute name (if not set, no elevation attribute is attached)',
'ELEV', optional=True))
self.addParameter(ParameterString(self.EXTRA,
'Additional creation parameters', ''))
'Additional creation parameters', '', optional=True))

self.addOutput(OutputVector(self.OUTPUT_VECTOR,
'Output file for contour lines (vector)'))
@@ -84,7 +84,7 @@ def defineCharacteristics(self):
'Copy all subdatasets of this file to individual output files',
False))
self.addParameter(ParameterString(self.EXTRA,
'Additional creation parameters', ''))
'Additional creation parameters', '', optional=True))
self.addOutput(OutputRaster(self.OUTPUT, 'Output layer'))

def processAlgorithm(self, progress):
@@ -67,7 +67,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterSelection(self.METHOD, 'Resampling method',
self.METHOD_OPTIONS))
self.addParameter(ParameterString(self.EXTRA,
'Additional creation parameters', ''))
'Additional creation parameters', '', optional=True))
self.addOutput(OutputRaster(self.OUTPUT, 'Output layer'))

def processAlgorithm(self, progress):
@@ -745,8 +745,8 @@ def setParamStringValue(self, param, widget):
else:
self.params[param.name] = value
else:
if widget.currentText() == '':
return False
#if widget.currentText() == '':
# return False
idx = widget.findText(widget.currentText())
if idx < 0:
name = self.getSafeNameForHarcodedParameter(param)
@@ -43,6 +43,9 @@ def __init__(self, name='', description='', default='', multiline=False,

def setValue(self, obj):
if obj is None:
if self.optional:
self.value = ''
return True
self.value = self.default
return True
self.value = unicode(obj).replace(ParameterString.ESCAPED_NEWLINE,

0 comments on commit 024f6a1

Please sign in to comment.
You can’t perform that action at this time.